/** * check submitted data before saving task */ public function check($usrId) { if ($this->isEmpty('begin')) { $this->set('begin', '9999-00-00'); } if ($this->isEmpty('deadline')) { $this->set('deadline', '9999-00-00'); } if ($this->isEmpty('member_id') && APP_SETUP_USER_MODEL) { $this->set('member_id', $usrId); } return parent::check('title'); }
public function other() { if ($this->_post('change')) { $models = new Model(); $y_price = $models->check($this->_post('price'), 'number'); $y_uid = $models->check($this->_post('uid'), 'number'); $y_explain = $models->check($this->_post('explain'), 'require'); if (!$y_price || !$y_uid || !$y_explain) { $this->error("提交的参数有误!"); } $user = M('user'); $use = $user->where('id=' . $this->_post('uid'))->find(); if ($use) { $Money = M('money'); $money = $Money->where('uid=' . $this->_post('uid'))->find(); if ($this->_post('change') == 1) { //奖励 $models->query("UPDATE `ds_money` SET `total_money` = `total_money`+" . $this->_post('price') . ", `available_funds` = `available_funds`+" . $this->_post('price') . " WHERE `uid` =" . $this->_post('uid')); //记录添加点 $money = $Money->where('uid=' . $this->_post('uid'))->find(); $moneyLog = $this->moneyLog(array(0, $this->_post('explain'), $this->_post('price'), '平台', $money['total_money'], $money['available_funds'], $money['freeze_funds'], $this->_post('uid')), 6); //资金记录 } else { if ($this->_post('price') > $money['available_funds']) { //如果操作金额超过用户可用资金 $this->error("操作金额超出用户可用资金!"); } $models->query("UPDATE `ds_money` SET `total_money` = `total_money`-" . $this->_post('price') . ", `available_funds` = `available_funds`-" . $this->_post('price') . " WHERE `uid` =" . $this->_post('uid')); //记录添加点 $money = $Money->where('uid=' . $this->_post('uid'))->find(); $moneyLog = $this->moneyLog(array(0, $this->_post('explain'), $this->_post('price'), '平台', $money['total_money'], $money['available_funds'], $money['freeze_funds'], $this->_post('uid')), 10); //资金记录 } //记录添加点 $this->Record($this->_post('explain')); //后台操作 $sendMsg = $this->silSingle(array('title' => $this->_post('explain'), 'sid' => $this->_post('uid'), 'msg' => $this->_post('explain'))); //站内信 $arr['member'] = array('uid' => $this->_post('uid'), 'name' => 'mem_other'); $vip_points = M('vip_points'); $vips = $vip_points->where('uid=' . $this->_post('uid'))->find(); if ($vips['audit'] == 2) { //判断是不是开通了VIP $arr['vip'] = array('uid' => $this->_post('uid'), 'name' => 'vip_other'); } $userss = M('user'); $promotes = $userss->where('id=' . $this->_post('uid'))->find(); if ($promotes['uid']) { //判断是不是有上线 $arr['promote'] = array('uid' => $promotes['uid'], 'name' => 'pro_other'); } $integralAdd = $this->integralAdd($arr); //积分操作 $this->success("操作成功", "__APP__/TIFAWEB_DSWJCMS/Fund/other"); } else { $this->error("用户不存在!"); } } else { $this->display(); } }
public function other() { $msgTools = A('msg', 'Event'); if ($this->_post('change')) { $models = new Model(); $y_price = $models->check($this->_post('price'), 'number'); $y_uid = $models->check($this->_post('uid'), 'number'); $y_explain = $models->check($this->_post('explain'), 'require'); if (!$y_price || !$y_uid || !$y_explain) { $this->error("提交的参数有误!"); } $user = M('user'); $use = $user->where('id=' . $this->_post('uid'))->find(); if ($use) { $Money = M('money'); $money = $Money->where('uid=' . $this->_post('uid'))->find(); if ($this->_post('change') == 1) { //奖励 $models->query("UPDATE `ds_money` SET `total_money` = `total_money`+" . $this->_post('price') . ", `available_funds` = `available_funds`+" . $this->_post('price') . " WHERE `uid` =" . $this->_post('uid')); } else { if ($this->_post('price') > $money['available_funds']) { //如果操作金额超过用户可用资金 $this->error("操作金额超出用户可用资金!"); } $models->query("UPDATE `ds_money` SET `total_money` = `total_money`-" . $this->_post('price') . ", `available_funds` = `available_funds`-" . $this->_post('price') . " WHERE `uid` =" . $this->_post('uid')); } //记录添加点 $money = $Money->where('uid=' . $this->_post('uid'))->find(); $this->Record($this->_post('explain')); //后台操作 $moneyLog = $this->moneyLog(array(0, $this->_post('explain'), $this->_post('price'), '平台', $money['total_money'], $money['available_funds'], $money['freeze_funds'], $this->_post('uid'))); //资金记录 $sendMsg = $msgTools->sendMsg(3, $this->_post('explain'), $this->_post('explain'), 'admin', $use['username']); //站内信 $arr['member'] = array('uid' => $this->_post('uid'), 'name' => 'mem_other'); $integralAdd = $this->integralAdd($arr); //积分操作 $this->success("操作成功", "__URL__/other"); } else { $this->error("用户不存在!"); } } else { $this->display(); } }
/** * check submitted data before saving task */ public function check() { return parent::check('task_id,start,stop,spent'); }