public function extrationdoedit()
 {
     $id = $_POST['id'];
     $info = $_POST['info'];
     $counttrader = $_POST['counttrader'];
     $total_money = M('shares_apply')->getFieldByid($id, "total_money");
     $uid = M('shares_apply')->getFieldByid($id, "uid");
     $order = M('shares_apply')->getFieldByid($id, "order");
     if (!getWantApply($id)) {
         $this->error('该配资已经申请停止操盘,请优先处理停止操盘申请!');
     }
     $user = M('members')->find($uid);
     if ($_POST['examiney'] == 2) {
         if ($counttrader < $total_money) {
             $this->error('HOMS总操盘金额小于所获配资总金额,无盈利,建议审核不通过!');
         } else {
             $extration = $counttrader - $total_money;
             $user_money = M('member_money')->where("uid = {$uid}")->find();
             $savemoney = array();
             $savemoney['account_money'] = $user_money['account_money'] + $extration;
             $ret = M('member_money')->where("uid = {$uid}")->save($savemoney);
             $status = array();
             $status['status'] = 2;
             $tr = M('shares_apply')->where("id = {$id}")->save($status);
             if ($ret && $tr) {
                 $info = $order . "申请提取盈利成功,共" . $extration . '元';
                 if (pzmembermoneylod($extration, $uid, $info, $id)) {
                     $info = '您在手投网申请提取盈利审核通过!【手投网】';
                     sendsms($user['user_phone'], $info);
                     $this->success('处理成功!');
                     alogs("extrationdoedit", 0, 1, '管理员执行了' . $order . '号订单盈利提取审核通过操作成功!');
                 } else {
                     $this->error('处理失败!');
                     alogs("extrationdoedit", 0, 1, '管理员执行了' . $order . '号订单盈利提取审核通过操作失败!');
                 }
             } else {
                 $this->error('资金出错!');
             }
         }
     } elseif ($_POST['examiney'] == 4) {
         $status = array();
         $status['status'] = 2;
         $tr = M('shares_apply')->where("id = {$id}")->save($status);
         if ($tr) {
             if (innermsg($uid, '申请提取盈利', $order . '订单HOMS没有盈利!')) {
                 $info = '您在手投网申请提取盈利审核未通过,原因为' . $info . '!【手投网】';
                 sendsms($user['user_phone'], $info);
                 $this->success('处理成功!');
                 alogs("extrationdoedit", 0, 1, '管理员执行了' . $order . '号订单盈利提取审核不通过操作成功!');
             } else {
                 $this->error('处理失败!');
                 alogs("extrationdoedit", 0, 1, '管理员执行了' . $order . '号订单盈利提取审核不通过操作失败!');
             }
         } else {
             $this->error('数据有误!');
         }
     }
 }
示例#2
0
function daydeduction($id)
{
    $apply = M('shares_apply')->where("id = {$id}")->find();
    $uid = $apply['uid'];
    $one_interest = $apply['manage_fee'] / $apply['duration'];
    if ($apply) {
        //如延期将从可用余额扣除
        if ($apply['already_manage_fee'] >= $apply['manage_fee']) {
            $usre_money = M('member_money')->where("uid = {$uid}")->find();
            if ($usre_money['account_money'] + $usre_money['back_money'] < $one_interest) {
                innermsg($uid, '管理费', '可用余额不足!');
                die;
            }
            if ($usre_money['back_money'] > $one_interest) {
                $usermoney['back_money'] = $usre_money['back_money'] - $one_interest;
            } else {
                $usermoney['account_money'] = $usre_money['back_money'] + $usre_money['account_money'] - $one_interest;
            }
            //$account_money['account_money'] = $usre_money['account_money'] - $one_interest;
            $ret = M('member_money')->where("uid = {$uid}")->save($usermoney);
            if ($ret) {
                $already_manage_fee['already_manage_fee'] = $apply['already_manage_fee'] + $one_interest;
                $applyret = M('shares_apply')->where("id = {$id}")->save($already_manage_fee);
                if ($applyret) {
                    $info = $apply['order'] . '延期将从可用余额扣除管理费' . $one_interest;
                    $log = pzmembermoneylod($one_interest, $uid, $info, $id);
                    innermsg($uid, '管理费', '管理费已扣完,将从可用余额扣除!');
                }
            }
        } else {
            //不延期将从冻结金额扣除并更新shares_apply标已支付管理费
            $usre_money = M('member_money')->where("uid = {$uid}")->find();
            $money_freeze['money_freeze'] = $usre_money['money_freeze'] - $one_interest;
            $ret = M('member_money')->where("uid = {$uid}")->save($money_freeze);
            if ($ret) {
                $already_manage_fee['already_manage_fee'] = $apply['already_manage_fee'] + $one_interest;
                $applyret = M('shares_apply')->where("id = {$id}")->save($already_manage_fee);
                if ($applyret) {
                    $info = $apply['order'] . '扣除管理费' . $one_interest;
                    $log = pzmembermoneylod($one_interest, $uid, $info, $id);
                    $end_interest = M('shares_apply')->where("id = {$id}")->find();
                    if ($end_interest['already_manage_fee'] == $end_interest['manage_fee']) {
                        innermsg($uid, '管理费', '管理费已扣完');
                    }
                }
            }
        }
    }
}