会长提现--更新

master
chenxiaojun 5 years ago
parent a12c3ecf9e
commit 0baf97f717

@ -1035,11 +1035,24 @@ public function auto_rrdae(){
return $ret; return $ret;
} }
//会长提现 //会长周结
public function promoteWithdraw() public function promoteWithdrawWeekly()
{
$this->promoteWithdraw(1);
}
//会长月结
public function promoteWithdrawPerMonth()
{
$this->promoteWithdraw(2);
}
//会长提现 $settlement 1-周结算 2-月结算
private function promoteWithdraw($settlement = 1)
{ {
$map['level'] = 1; $map['level'] = 1;
$map['ver_status'] = 1; $map['ver_status'] = 1;
$map['settlement_type'] = $settlement;
$promotes = M('promote', 'tab_')->field('id, account, chain')->where($map)->select(); $promotes = M('promote', 'tab_')->field('id, account, chain')->where($map)->select();
$success = 0; $success = 0;
$error_withdraw = 0; $error_withdraw = 0;

@ -313,6 +313,10 @@ class PromoteController extends ThinkController
if (!empty(I('company_id')) && $promote['level'] ==1) { if (!empty(I('company_id')) && $promote['level'] ==1) {
$data['company_id'] = I('company_id'); $data['company_id'] = I('company_id');
} }
$settlementType = intval(I('settlement_type', 1));
if (!empty(I('settlement_type')) && in_array($settlementType, [1, 2])) {
$data['settlement_type'] = $settlementType;
}
$res = M("promote", "tab_")->where(array("id"=>$_POST['id']))->save($data); $res = M("promote", "tab_")->where(array("id"=>$_POST['id']))->save($data);
if ($res !== false) { if ($res !== false) {
if (!empty(I('company_id')) && $promote['level'] ==1) {//修改会长底下推广员的推广公司 if (!empty(I('company_id')) && $promote['level'] ==1) {//修改会长底下推广员的推广公司

@ -225,6 +225,22 @@
<span class="notice-text">显示推广员的平台币余额,推广员平台币用于会长代充或者转移给下级推广员</span> <span class="notice-text">显示推广员的平台币余额,推广员平台币用于会长代充或者转移给下级推广员</span>
</td> </td>
</tr> </tr>
<if condition="$data['level'] eq 1">
<tr>
<td class="l">结算模式:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" value="1" name="settlement_type" <eq name="data['settlement_type']" value="1">checked="checked"</eq>>周结
</label>
<label>
<input type="radio" value="2" name="settlement_type" <eq name="data['settlement_type']" value="2">checked="checked"</eq>>月结
</label>
</span>
<span class="notice-text">会长推广结算模式</span>
</td>
</tr>
</if>
</tbody> </tbody>
</table> </table>
</div> </div>

@ -340,6 +340,10 @@ class FinanceController extends BaseController
$add['widthdraw_number'] = $this->produceWithdrawNumber(); $add['widthdraw_number'] = $this->produceWithdrawNumber();
$add['settlement_end_time'] = $thisDay - 1; $add['settlement_end_time'] = $thisDay - 1;
$add['spend_ids'] = ''; $add['spend_ids'] = '';
$add['op_id'] = $this->loginPromote['id'];
$add['op_type'] = 1;
$add['last_op_id'] = $this->loginPromote['id'];
$add['last_op_type'] = 1;
M()->startTrans();//开启事物 M()->startTrans();//开启事物
$withdrawId = M('withdraw', 'tab_')->add($add); $withdrawId = M('withdraw', 'tab_')->add($add);
@ -634,6 +638,8 @@ class FinanceController extends BaseController
$save['status'] = 0; $save['status'] = 0;
$save['id'] = $id; $save['id'] = $id;
$save['last_op_id'] = $this->loginPromote['id'];
$save['last_op_type'] = 1;
$res = M('withdraw', 'tab_')->save($save); $res = M('withdraw', 'tab_')->save($save);
if ($res === false) { if ($res === false) {
$data['status'] = 0; $data['status'] = 0;
@ -686,6 +692,8 @@ class FinanceController extends BaseController
$withdrawSave['status'] = -2; $withdrawSave['status'] = -2;
$withdrawSave['spend_ids'] = $spendIds; $withdrawSave['spend_ids'] = $spendIds;
$withdrawSave['last_up_update_time'] = $time; $withdrawSave['last_up_update_time'] = $time;
$withdrawSave['last_op_id'] = $this->loginPromote['id'];
$withdrawSave['last_op_type'] = 1;
M('withdraw', 'tab_')->startTrans();//开启事物 M('withdraw', 'tab_')->startTrans();//开启事物
$withdrawRes = M('withdraw', 'tab_')->save($withdrawSave); $withdrawRes = M('withdraw', 'tab_')->save($withdrawSave);

@ -927,4 +927,9 @@ ALTER TABLE `tab_withdraw`
ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人1-推广员 2-管理员 3-自动'; ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人1-推广员 2-管理员 3-自动';
ALTER TABLE `tab_withdraw` ALTER TABLE `tab_withdraw`
ADD COLUMN `last_op_id` int(11) NOT NULL DEFAULT 0 COMMENT '最后操作人id', ADD COLUMN `last_op_id` int(11) NOT NULL DEFAULT 0 COMMENT '最后操作人id',
ADD COLUMN `last_op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '最后操作人1-推广员 2-管理员 3-自动'; ADD COLUMN `last_op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '最后操作人1-推广员 2-管理员 3-自动';
-- 2019-12-31
-- 推广员结算类型 cxj
ALTER TABLE `tab_promote`
ADD COLUMN `settlement_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '结算类型1-周结 2-月结';
Loading…
Cancel
Save