Ejemplo n.º 1
0
function doapplyeven($id, $counttrader)
{
    //配资id	 剩余金额
    $apply = M("shares_apply")->find($id);
    //计算是否还有剩余未付管理费
    $surplus = ($apply['manage_fee'] - $apply['already_manage_fee']) / $apply['one_manage_fee'];
    if ($surplus >= 1) {
        //执行平仓
        if (monthopen($id, $counttrader)) {
            //罚一个月管理费
            $member_money = M("member_money")->where("uid = {$apply['uid']}")->find();
            $savedata['uid'] = $member_money['uid'];
            $savedata['account_money'] = $member_money['account_money'] - $apply['one_manage_fee'];
            $ret = M("member_money")->save($savedata);
            if ($ret) {
                $info = $apply['order'] . "订单提前平仓扣除罚金";
                pzmembermoneylod($apply['one_manage_fee'], $member_money['uid'], $info, $apply['id']);
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        $ret = monthopen($id, $counttrader);
        if ($ret) {
            return true;
        } else {
            return false;
        }
    }
}
 public function opendoedit()
 {
     $id = $this->_post('id');
     $counttrader = $this->_post('counttrader');
     //HOMS总操盘金额
     $ret = monthopen($id, $counttrader, $this->_post("info"));
     if ($ret) {
         alogs("opendoedit", 0, 1, '管理员执行了股票配资平仓操作成功!');
         $this->success('平仓成功!');
     } else {
         alogs("opendoedit", 0, 1, '管理员执行了股票配资平仓操作失败!');
         $this->error('平仓失败!');
     }
 }