时间:2021-07-01 10:21:17 帮助过:6人阅读
public function add(){
$this->lottory_record_db=M('Lottery_record');
$this->lottory_db=M('Lottery');
if($_POST['action'] == 'add' ){
$lid = $this->_post('lid');
$wechaid = $this->_post('wechaid');
//$data['sn'] = $this->_post('sncode');
$data['phone'] = $this->_post('tel');
//$data['prize'] = $this->_post('winprize');
$data['wecha_name'] = $this->_post('wxname');
//$data['time'] = time();
//$data['islottery'] = 1;
//$data['usenums'] = 1;
$rid=intval($this->_post('rid'));
if (!$rid){
$thisRecord=$this->lottory_record_db->where(array('lid'=>$lid,'wecha_id'=>$wechaid,'islottery'=>1))->find();
$rid=$thisRecord['id'];
}
$rollback = $this->lottory_record_db->where(array('lid'=>$lid,'wecha_id'=>$wechaid,'id'=>$rid))->save($data);
$record=$this->lottory_record_db->where(array('id'=>$rid))->find();
echo'{"success":1,"msg":"恭喜!尊敬的'.$data['wecha_name'].'请您保持手机通畅!你的领奖序号:'.$record['sn'].'"}';
exit;
}
}
输出看看值是什么?确定条件成立?
var_dump($_POST['action']);//