public function saveAction() { $post = filterAllParam('post'); $hongbao = M("hongbao_setting"); if (!isset($post['set_id']) || !$post['set_id']) { $hbnumber = $hongbao->where('set_weixin = "' . $post['set_weixin'] . '"')->count(); if ($hbnumber) { $this->error("一个公众号只能设置一个红包"); } } if (isset($post['set_id']) && $post['set_id']) { $isok = $hongbao->where('set_id="' . $post['set_id'] . '"')->save($post); } else { $isok = $hongbao->add($post); } if ($isok) { $this->success('保存成功', 'list'); } else { $this->error("保存失败"); } }
public function saveAction() { $post = filterAllParam('post'); if (!$post['id'] && !$post['weixin_number']) { $this->error('请填写公众号原始ID'); } if (!$post['weixin_callbackurl']) { $this->error('请填写回调地址'); } if (!$post['weixin_name']) { $this->error('请填写公众号名称'); } if (!$post['weixin_appid']) { $this->error('请填写AppID'); } if (!$post['weixin_appsecret']) { $this->error('请填写AppSecret'); } if (!$post['weixin_token']) { $this->error('请填写Token'); } $weixin = M('weixin'); $isdelimage = $post['delweixin_imgcode']; if ($isdelimage) { $post['weixin_imgcode'] = ''; unlink('./upload/' . $isdelimage); } if ($_FILES['weixin_imgcode']['name']) { $upload = new \Think\Upload(); $upload->maxSize = 3145728; //3M $upload->exts = array('jpg', 'gif', 'png', 'jpeg'); $upload->rootPath = './upload/'; $uploadinfo = $upload->uploadOne($_FILES['weixin_imgcode']); if (!$uploadinfo) { $this->error($upload->getError()); } $post['weixin_imgcode'] = $uploadinfo['savepath'] . $uploadinfo['savename']; } else { if ($isdelimage) { $this->error('请上传公众号二维码'); } } if ($post['weixin_dispatchtoken']) { $post['weixin_callbackurl'] = 'http://' . $_SERVER['SERVER_NAME'] . '/index.php/api/' . $post['weixin_dispatchtoken']; $post['weixin_token'] = $post['weixin_dispatchtoken']; } if (isset($post['id']) && $post['id']) { $wx_id = $post['id']; unset($post['id']); unset($post['delweixin_imgcode']); $edunumber = $weixin->where('weixin_id="' . $wx_id . '"')->setField($post); if ($edunumber) { $id = $wx_id; } else { $id = ''; } } else { $post['weixin_regdate'] = date('Y-m-d H:i:s'); $id = $weixin->add($post); } if ($id) { $this->success('保存公众号成功', 'list'); } else { $this->error('保存公众号失败'); } }
public function savetxAction() { $post = filterAllParam('post'); $setting = M("hongbao_setting"); $setinfo = $setting->where('set_id = 1')->find(); $user = M('user'); $wxuser = $user->where('user_id = "' . $post['tx_userid'] . '"')->find(); if (!$wxuser) { $this->error('未知用户'); } if ($wxuser['user_money'] < $setinfo['set_getmoney']) { $set_tixian_nomoney_msg = str_replace('##', $setinfo['set_getmoney'], $setinfo['set_tixian_nomoney']); $this->error($set_tixian_nomoney_msg); } if ($post['tx_number'] > $wxuser['user_money']) { $this->error('您输入的金额大于你账户拥有的资金'); } $tixian = M("hongbao_tixian"); unset($post['tx_card2']); unset($post['totel_money']); $post['tx_date'] = date('Y-m-d H:i:s'); $isok = $tixian->add($post); if ($isok) { $user->where('user_id = "' . $post['tx_userid'] . '"')->setDec('user_money', $post['tx_number']); $this->success('提现成功', U('index/index')); } else { $this->error("提现失败"); } }
public function savebmAction() { if ($_FILES['weibo_send1']['name']) { $upload = new \Think\Upload(); $upload->maxSize = 3145728; //3M $upload->exts = array('jpg', 'gif', 'png', 'jpeg'); $upload->rootPath = './upload/'; $uploadinfo = $upload->uploadOne($_FILES['weibo_send1']); if (!$uploadinfo) { $this->error($upload->getError()); } $_POST['weibo_send1'] = $uploadinfo['savepath'] . $uploadinfo['savename']; } if ($_FILES['weibo_send2']['name']) { $upload = new \Think\Upload(); $upload->maxSize = 3145728; //3M $upload->exts = array('jpg', 'gif', 'png', 'jpeg'); $upload->rootPath = './upload/'; $uploadinfo = $upload->uploadOne($_FILES['weibo_send2']); if (!$uploadinfo) { $this->error($upload->getError()); } $_POST['weibo_send2'] = $uploadinfo['savepath'] . $uploadinfo['savename']; } if ($_FILES['weibo_send3']['name']) { $upload = new \Think\Upload(); $upload->maxSize = 3145728; //3M $upload->exts = array('jpg', 'gif', 'png', 'jpeg'); $upload->rootPath = './upload/'; $uploadinfo = $upload->uploadOne($_FILES['weibo_send3']); if (!$uploadinfo) { $this->error($upload->getError()); } $_POST['weibo_send3'] = $uploadinfo['savepath'] . $uploadinfo['savename']; } $baoming = M("baoming"); $post = filterAllParam('post'); unset($post['area']); $post['baoming_date'] = date('Y-m-d H:i:s'); $baomingid = $baoming->add($post); if ($baomingid) { $this->success('报名成功', U('vote/showVote', array('voteid' => $post['vote_id']))); } else { $this->error("报名失败"); } }