/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $user = Sp_Account_User::current(); $nowtime = time(); // 当前页数 $nowPage = $request->page; empty($nowPage) && ($nowPage = 1); $limitRow = ($nowPage - 1) * self::PAGE_SIZE; // 分页数据 $array = Sp_Active_Active::getListByUser($user->id, "a.isdel = 0 and a.activit_end < {$nowtime}", $limitRow, self::PAGE_SIZE); // 分页 $pageString = Sp_Active_Active::getPageString($user->id, $nowPage, self::PAGE_SIZE, "isdel = 0 and activit_end < {$nowtime}"); $data = array(); if (is_array($array)) { $data['status'] = '0'; $data['data'] = $array; $data['msg'] = ''; $data['nowtime'] = $nowtime; $data['pageString'] = $pageString; } else { $data['status'] = '-1'; $data['data'] = array(); $data['msg'] = ''; } return $data; } }
public function execute($request) { if ($request->format == 'json') { $data = array(); $email = $request->email; $mobile = $request->mobile; $patternEmail = Sp_Dictionary::getOtherOption('patternEmail'); $patternMobile = Sp_Dictionary::getOtherOption('patternMobile'); if (false == preg_match($patternEmail, $email)) { return array('status' => '-120', 'msg' => '邮件格式不正确'); } else { if (false == preg_match($patternMobile, $mobile)) { return array('status' => '-121', 'msg' => '电话格式不正确'); } } $user = Sp_Account_User::current(); $data['name'] = $request->name; $data['gender'] = $request->gender; $data['mobile'] = $mobile; $data['email'] = $email; $data['province'] = $request->province; $data['city'] = $request->city; $data['area'] = $request->area; $data['face'] = $request->face; $ret = Sp_Account_Info::updateUser($user->id, $data); return array('status' => '0', 'msg' => '成功'); } }
/** * 检查旧密码 (md5(md5(密码)+kid)) * * @param string $oldpassword 旧密码 * @param array $data 用户数据 */ public function checkOldPassword($oldpassword, &$data) { $tmppwd = Sp_Account_User::encrypt($oldpassword, $data['kid']); if ($tmppwd == $data['pwd']) { return true; } return false; }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $user = Sp_Account_User::current(); $aid = $request->id; if (!is_numeric($aid)) { $data = array(); $data['status'] = '-1'; $data['msg'] = '提交数据有误'; return $data; } // 当前页数 $nowPage = $request->page; empty($nowPage) && ($nowPage = 1); $limitRow = ($nowPage - 1) * self::PAGE_SIZE; // 分页数据 $array = Sp_Letter_Letter::getListByUser($user->id, $aid, $limitRow, self::PAGE_SIZE); $total = Sp_Letter_Letter::getTotalByUser($user->id, $aid); if (is_array($array) && count($array)) { $cry = new Util_Crypt3Des(); foreach ($array as $key => $value) { $id = $cry->encrypt($value['id']); $id = base64_encode($id); $array[$key]['sid'] = $id; } } // 分页 $pager = new Util_Pager($total, $nowPage, self::PAGE_SIZE); $pageString = $pager->renderNav(true); $data = array(); if (is_array($array)) { $data['status'] = '0'; $data['data'] = $array; $data['msg'] = ''; $data['pageString'] = $pageString; $data['nowtime'] = time(); } else { $data['status'] = '-1'; $data['data'] = array(); $data['msg'] = ''; } return $data; } else { $aid = $request->id; if (!is_numeric($aid)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (empty($active)) { $this->show404(); } $view = new Sp_View(); $view->assign('active', $active); $view->assign('select', 'letter'); $view->display("letter/index.html"); } }
public function __construct() { $user = Sp_Account_User::current(); if ($user->isLogin() === FALSE) { //未登录跳转 header("Location: " . SP_URL_HOME); exit; } }
/** * 有post提交 * 采用post提交 * return json array('status'=>'0','msg'=>'成功') */ public function execute($request) { if ($request->format == 'json') { if ($request->type == "pwdcode") { //发送修改账号短信验证码 $result = $this->checkCaptchaAndUser($request->username, $request->code, $request->type); if (TRUE === $result) { $username = $request->username; //计算验证码 $code = rand(100000, 999999); $content = "您本次在会通网修改密码的验证码为:" . $code . ",任何人索取验证码均为咋骗,切勿泄露!此验证码会在15分钟后失效"; $sms = array(); $sms['username'] = $username; $sms['content'] = $content; $sms['type'] = 'pwdcode'; $sms['code'] = $code; $sms['user_id'] = Sp_Account_SignIn::getUserIdBySignIn($username); Sp_Sendmsg::send($sms); return array('status' => '0', 'msg' => '发送成功'); } else { return $result; } } else { if ($request->type == "repwd") { //修改密码 $result = $this->checkCodeAndUser($request->username, $request->code, 'pwdcode'); if (TRUE === $result) { $username = $request->username; //计算验证码 $code = rand(100000, 999999); $ret = Sp_Account_User::RePwd($username, $code); if ($ret) { $content = "您本次修改的密码为:" . $code . ",任何人索取验证码均为咋骗,切勿泄露!此验证码会在15分钟后失效"; $sms = array(); $sms['username'] = $username; $sms['content'] = $content; $sms['type'] = 'repwd'; $sms['user_id'] = Sp_Account_SignIn::getUserIdBySignIn($username); Sp_Sendmsg::send($sms); return array('status' => '0', 'msg' => '发送成功'); } else { return array('status' => '-1', 'msg' => '修改失败'); } } else { return $result; } } else { return array('status' => '-101', 'msg' => '提交参数错误'); } } } // else{ // //var_dump($list); // $view = new Sp_View; // $view->display('test/home.html'); // } }
public function __construct($config) { $user = Sp_Account_User::current(); $where = array('id' => @$_REQUEST['activeId'], 'user_id' => $user->id ? $user->id : $config); if ($where['id']) { $result = Da_Wrapper::select()->table("sp.huitong.ht_active")->columns('id')->where($where)->getOne(); if (false == $result) { exit("参数错误"); } } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; if (!is_numeric($id)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $rs = Sp_Letter_Letter::delByPrimarykey($id, $user->id); return array('status' => '0', 'msg' => '删除成功'); } }
public function execute($request) { global $priv; $user = Sp_Account_User::current(); $user = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area')); $uploadInfo = Util_FileUpload::getUpfileKey('huitong'); $view = new Sp_View(); $view->assign('user', $user); $view->assign('action', $priv); $view->assign('uploadInfo', $uploadInfo); $view->display("account/password.html"); }
public function execute($request) { $user = Sp_Account_User::current(); if ($user->isLogin() === FALSE) { //未登录跳转 echo 'document.write(\'<div class="menu"><a href="javascript:void(0);" ms-click="showlogin" class="ht-btn-blue">登录</a><a href="javascript:void(0);" ms-click="showreg" class="ht-btn-gray">注册</a></div>\')'; } else { $userInfo = Sp_Account_User::getUser($user->id, array('face')); $pic = empty($userInfo['face']) ? SP_URL_IMG . 'dzx.jpg' : SP_URL_UPLOAD . $userInfo['face']; $html = '<div class="ht-user">' . '<a href="javascript:void(0);" class="ht-user-navlink show">' . '<img src="' . $pic . '" /></a>' . '<div class="ht-user-dropdown">' . '<a href="/active/index.html" class="line">' . '<i class="ht-topNav-icon01"></i>' . '<span>我的活动</span></a>' . '<a href="/account/index.html" >' . '<i class="ht-topNav-icon02"></i><span>我的信息</span></a>' . '<a href="/account/password.html" class="line">' . '<i class="ht-topNav-icon03"></i>' . '<span>修改密码</span></a>' . '<a href="/user/signout.html" >' . '<i class="ht-topNav-icon05"></i>' . '<span>退出</span></a></div></div>'; echo 'document.write(\'' . $html . '\')'; } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $aid = $request->aid; if (!is_numeric($id) || !is_numeric($aid)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (is_array($active) && count($active) > 1) { $at = Sp_Account_Attendee::getAttendeeById($id); if ($at['activeId'] == $aid && $at['status'] == 0 && ($at['checkStatus'] == 0 || $at['checkStatus'] == 1)) { $row = Sp_Sendmsg::getSmsByPhone($at['phone'], 'attendee'); if (is_array($row) && count($row) < 3) { $nowDate = date("Y-m-d", time()); $msgDate = date("Y-m-d", $row['crttime']); if ($nowDate == $msgDate) { return array('status' => '-126', 'msg' => '该电子票已在当天发送过,不能重复发送。', 'data' => $shortArr); } } $code = $this->getSignIdCode($at); if (false == $code) { return array('status' => '-1', 'msg' => '生成电子票失败'); } $url = SP_URL_HOME . "attendee/code/" . $code . ".html"; $shortArr = Util_ShortUrl::shortSina($url); if ($shortArr === FALSE) { return array('status' => '-1', 'msg' => '生成电子票失败'); } else { $content = $at['name'] . "你好:你已报名成功" . $active['title'] . ",会议时间:" . date("Y-m-d H:i", $active['activit_start']) . " ~ " . date("Y-m-d H:i", $active['activit_start']) . ",会议地点:" . $active['address'] . "。您的电子票为" . $shortArr['url_short'] . ",签到码为" . $code . ",请保留此短信至会议结束。"; $sms = array(); $sms['username'] = $at['phone']; $sms['content'] = $content; $sms['type'] = 'attendee'; $sms['user_id'] = $user->id; Sp_Sendmsg::send($sms); if ($at['checkStatus'] == 0) { Sp_Account_Attendee::success($id); } return array('status' => '0', 'msg' => '发送成功'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } }
/** * function description * * @param * @return void */ public function execute($request) { /*$total = 90; $page = 8; $size = 10; $pager = new Util_Pager($total, $page, $size, "?page=%d&activeId=19"); $offset = $pager->getOffset(); $pager->setTotal($total); echo $pager->renderNav();*/ $model = new Sp_Account_Attendee(); $activeId = $request->activeId; $header = $model->GetTableHeaderByActiveId($activeId); if (false == $header) { $showHeader = $this->headers; } else { $showHeader = $this->getShowHeader($header); $showHeader = $model->getColumnFormArr($showHeader, 'title', 'field'); } $columns = array_keys($showHeader); array_push($columns, 'id'); $columns[] = 'status'; $columns[] = 'checkStatus'; $dataProvide = $model->AttendeeList($activeId, $columns); if ($request->format == 'json') { $arrary = array(); return $array; } else { /*$user = Sp_Account_User::current(); $user = Sp_Account_User::load($user->id);*/ $aid = $request->activeId; if (!is_numeric($aid)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (empty($active)) { $this->show404(); } $view = new Sp_View(); $view->assign('active', $active); $view->assign('data', $dataProvide[1]); $view->assign('page', $dataProvide[0]); $view->assign('header', $showHeader); $view->assign('headerSet', json_encode($header)); $view->assign('activeId', $activeId); $view->assign('uploadInfo', $uploadInfo); $view->display("attendee/index.html"); } }
/** * function description * * @param * @return void */ public function execute($request) { header("Content-type:text/html;charset=utf-8"); if ($request->format == 'json') { if (isset($_POST["_huitong_user"])) { $cookie_user = urldecode($_POST['_huitong_user']); $user = Sp_Account_User::parseStored($cookie_user); $activeId = $request->activeId; if (!is_numeric($user['id']) || $user['id'] < 1 || !is_numeric($activeId) || $activeId < 1) { $jsonParam = array('code' => '500', 'message' => '上传错误'); echo json_encode($jsonParam); exit; } $arrary = array(); $up = new Util_Upload(array('savepath' => UPLOAD_ROOT . 'attendee', 'subdirpattern' => 'Y/m/d', 'israndname' => true, 'allowtype' => array('xls', 'xlsx'), 'maxsize' => 5120000)); $up->uploadFile('file'); // input's name property $msg = $up->getErrorMsg(); $jsonParam = array(); if (empty($msg)) { $filename = $up->getUploadFileName(); if (is_readable($filename) == false) { $jsonParam = array('code' => '500', 'message' => '文件不可读'); echo json_encode($jsonParam); exit; } @chmod($filename, 0777); $data = array('userId' => $user['id'], 'fileDir' => $filename); $data['activeId'] = $activeId; $lastid = Sp_Account_Attendee::uploadLog($data); if ($lastid) { if (class_exists('GearmanClient')) { $client_active = MQClient::factory('participants'); $client_active->send('importParticipants', $data, false); } } $jsonParam = array('code' => '200', 'message' => 'ok', 'url' => '', 'time' => time()); } else { $jsonParam = array('code' => '500', 'message' => $msg); } echo json_encode($jsonParam); } else { $jsonParam = array('code' => '500', 'message' => '错误访问'); echo json_encode($jsonParam); } } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $t = $request->type; if ('music' == $t) { $up = new Util_Upload(array('savepath' => UPLOAD_ROOT . 'music', 'subdirpattern' => 'Y/m/d', 'israndname' => true, 'allowtype' => array('wav', 'mp3'), 'maxsize' => 5120000)); $up->uploadFile('file'); // input's name property $msg = $up->getErrorMsg(); if (empty($msg)) { $filename = $up->getUploadFileName(); $filename = str_replace(UPLOAD_ROOT, "", $filename); $name = $_FILES['file']['name']; $user = Sp_Account_User::current(); $material = array(); $material['user_id'] = $user->id; $material['type'] = 2; $material['name'] = $name; $material['url'] = $filename; Sp_Letter_Material::add($material); return array('status' => '0', 'msg' => '上传成功', 'data' => $filename); } else { return array('status' => '-1', 'msg' => $msg); } } else { if ('image' == $t) { $up = new Util_Upyun(array('save_path' => UPLOAD_ROOT . 'image/', 'save_url' => 'huitong/')); $msg = $up->uploadFile('file'); if ($msg['status'] == 0) { $name = $_FILES['file']['name']; $user = Sp_Account_User::current(); $material = array(); $material['user_id'] = $user->id; $material['type'] = 1; $material['name'] = $name; $material['url'] = $msg['data']; Sp_Letter_Material::add($material); } return $msg; } else { return array('status' => '-2', 'msg' => '未上传'); } } } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { return array(); } else { $id = $request->id; if (empty($id) || !is_numeric($id)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($id, $user->id); if (empty($active)) { $this->show404(); } $view = new Sp_View(); $view->assign("active", $active); $view->display("active/createsuccess.html"); } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $active_id = $request->active_id; $title = $request->title; $discrib = $request->discrib; if (!is_numeric($active_id) || empty($title)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $letter = array(); $letter['user_id'] = $user->id; $letter['title'] = $title; $letter['discrib'] = $discrib; $letter['active_id'] = $active_id; $lastid = Sp_Letter_Letter::add($letter); if (is_numeric($lastid) && $lastid > 0) { return array('status' => '0', 'msg' => '添加成功', 'data' => $lastid); } else { return array('status' => '-1', 'msg' => '添加失败'); } } }
public function execute($request) { global $priv; $user = Sp_Account_User::current(); $uploadInfo = Util_FileUpload::getUpfileKey('huitong'); $province = Sp_City_City::getProvince(); $view = new Sp_View(); $userInfo = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area', 'mobile_status', 'email_status')); $auth = array('mobile_status' => $userInfo['mobile_status'], 'email_status' => $userInfo['email_status']); $view->assign('province', $province); $view->assign('action', $priv); $view->assign('auth', $auth); if (!empty($userInfo['province'])) { $city = Sp_City_City::getChlidById($userInfo['province']); $view->assign('city', $city); } if (!empty($userInfo['city'])) { $arrea = Sp_City_City::getChlidById($userInfo['city']); $view->assign('arrea', $arrea); } $view->assign('uploadInfo', $uploadInfo); $view->display("account/index.html"); }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $aid = $request->aid; if (!is_numeric($id) || !is_numeric($aid)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (is_array($active) && count($active) > 1) { $at = Sp_Account_Attendee::getAttendeeById($id); if ($at['activeId'] == $aid && $at['checkStatus'] == 0) { $rs = Sp_Account_Attendee::refuse($id); return array('status' => '0', 'msg' => '拒绝成功'); } else { return array('status' => '-1', 'msg' => '数据有误'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } }
public function execute($request) { $user = Sp_Account_User::current(); $user->signout(); header("Location: /"); }
/** * 支付完成后返回处理 * * @param array params * @return void */ public function complete($params) { $view = new Sp_View(); # 解析返回参数. $return = Sp_Payment_Yeepay_Common::getCallBackValue($r0_Cmd, $r1_Code, $r2_TrxId, $r3_Amt, $r4_Cur, $r5_Pid, $r6_Order, $r7_Uid, $r8_MP, $r9_BType, $hmac); # 判断返回签名是否正确(True/False) $bRet = Sp_Payment_Yeepay_Common::CheckHmac($r0_Cmd, $r1_Code, $r2_TrxId, $r3_Amt, $r4_Cur, $r5_Pid, $r6_Order, $r7_Uid, $r8_MP, $r9_BType, $hmac); # 以上代码和变量不需要修改. # 校验码正确. if ($bRet) { if ($r1_Code == "1") { # 需要比较返回的金额与商家数据库中订单的金额是否相等,只有相等的情况下才认为是交易成功. # 并且需要对返回的处理进行事务控制,进行记录的排它性处理,在接收到支付结果通知后,判断是否进行过业务逻辑处理,不要重复进行业务逻辑处理,防止对同一条交易重复发货的情况发生. $user_id = $r8_MP; //用户id $sn = trim($r6_Order); //订单号 $amount = floatval($r3_Amt); //金额 $recharge_info = Sp_Trade_Recharge::getBySn($sn); if (floatval($recharge_info['amount']) == $amount and $recharge_info['user_id'] == $user_id) { if ($r9_BType == "1") { #交易成功 在线支付页面返回 $request = Request::current(); if ($request->isMobile()) { Loader::redirect(SP_URL_WAP . 'moneyrecord.html'); } else { Loader::redirect(SP_URL_USER . 'moneyrecord.html'); } /* $ret = false; if($recharge_info['status'] < 1) { $param = array( 'id' => $recharge_info['id'], 'user_id' => $user_id, 'sn' => $sn, 'amount' => $amount, 'bank_sn' => $_REQUEST['ro_BankOrderId'], 'trd_sn' => $_REQUEST['r2_TrxId'], 'remark' => json_encode($_REQUEST) ); $ret = Sp_Trade_Tradeprocess::recharge($param); } if($ret) {//处理成功 $user = Sp_Account_User::getUserBase($user_id); //用户信息 $data = array( 'user_id' => $user_id, 'account' => $amount, 'user_name' => $user->data["username"], 'email' => $user->data['email'], 'realname' => $user->data["username"], 'phone' => $user->data['phone'], ); Sp_Message::send('recharge', $data);//发送消息 Loader::redirect(SP_URL_USER.'moneyrecord.html'); }elseif($recharge_info['status'] < 1) {//失败 echo '资金流处理失败!'; $body = print_r($_REQUEST,true); Sp_Admin_Mail::send('*****@*****.**', '资金流处理失败!', $body); }else{ $request = Request::current(); if($request->isMobile()) { Loader::redirect(SP_URL_WAP.'moneyrecord.html'); }else{ Loader::redirect(SP_URL_USER.'moneyrecord.html'); } }*/ } elseif ($r9_BType == "2") { #如果需要应答机制则必须回写流,以success开头,大小写不敏感. $ret = false; if ($recharge_info['status'] == 1) { echo "success"; } elseif ($recharge_info['status'] < 1) { $param = array('id' => $recharge_info['id'], 'user_id' => $user_id, 'sn' => $sn, 'amount' => $amount, 'bank_sn' => $_REQUEST['ro_BankOrderId'], 'trd_sn' => $_REQUEST['r2_TrxId'], 'remark' => json_encode($_REQUEST)); $amount_num = Sp_Trade_Recharge::getUserRechargeReport('WHERE status = 1 AND user_id=' . $user_id); $ret = Sp_Trade_Tradeprocess::recharge($param); if ($ret) { //处理成功 //首冲奖励 if ($amount_num == 0) { $active_send_info = array('uid' => $user_id, 'type' => 'first_recharge'); $client_active = MQClient::factory('active'); $client_active->send('activePrizeReset_new_register', $active_send_info); } $user = Sp_Account_User::getUserBase($user_id); //用户信息 $data = array('user_id' => $user_id, 'account' => $amount, 'user_name' => $user->data["username"], 'email' => $user->data['email'], 'realname' => $user->data["username"], 'phone' => $user->data['phone']); Sp_Message::send('recharge', $data); //发送消息 } else { echo '资金流处理失败!'; $body = print_r($_REQUEST, true); Sp_Admin_Mail::send('*****@*****.**', '资金流处理失败!', $body); } } } } } } else { $body = print_r($_REQUEST, true); Sp_Admin_Mail::send('*****@*****.**', '易宝支付失败(签名验证失败)', $body); $view->assign('error_message', "抱歉,您的支付没有成功,请重新支付,谢谢"); $view->out_404(); return; } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $activit_end = $request->activit_end; //活动结束时间 $activit_start = $request->activit_start; //活动开始时间 $address = $request->address; //详细地址 $arrea = $request->arrea; //区域 $city = $request->city; //城市 $enroll_end = $request->enroll_end; $enroll_start = $request->enroll_start; $is_audit = $request->is_audit; $is_enroll = $request->is_enroll; //是否需要审核 $province = $request->province; //省份 $title = $request->title; //标题 $thumbnail = $request->thumbnail; $enroll_num = $request->enroll_num; if (!is_numeric($id) || empty($title) || empty($activit_end) || empty($activit_end) || empty($address) || empty($province) || empty($city)) { return array('status' => '-5', 'msg' => '参数错误'); } if (!empty($is_enroll) && (empty($is_audit) || empty($enroll_start) || empty($enroll_end))) { return array('status' => '-5', 'msg' => '完善活动时间选项'); } if (strtotime($activit_end) < strtotime($activit_start)) { return array('status' => '-5', 'msg' => '举办结束日期不能小于开始日期'); } $user = Sp_Account_User::current(); $active = array(); $active['activit_end'] = strtotime($activit_end); $active['activit_start'] = strtotime($activit_start); $active['address'] = $address; $active['arrea'] = empty($arrea) ? 0 : $arrea; $active['city'] = $city; $active['province'] = $province; $active['title'] = $title; $active['user_id'] = $user->id; $active['thumbnail'] = $thumbnail; if (!empty($is_audit)) { if (strtotime($enroll_end) < strtotime($enroll_start)) { return array('status' => '-5', 'msg' => '报名结束日期不能小于开始日期'); } if (!is_numeric($enroll_num)) { return array('status' => '-5', 'msg' => '人数不能为空'); } $active['is_audit'] = 1; $active['is_enroll'] = 1; $active['enroll_start'] = strtotime($enroll_start); $active['enroll_end'] = strtotime($enroll_end); $active['enroll_num'] = $enroll_num; } else { $active['is_audit'] = 0; $active['is_enroll'] = 0; $active['enroll_start'] = 0; $active['enroll_end'] = 0; $active['enroll_num'] = 0; } $user = Sp_Account_User::current(); $ret = Sp_Active_Active::updateById($id, $active, $user->id); return array('status' => '0', 'msg' => '修改成功'); // if($ret){ // // }else{ // return array('status'=>'-1','msg'=>'修改失败'); // } } else { $aid = $request->id; if (!is_numeric($aid)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (empty($active)) { $this->show404(); } $province = Sp_City_City::getProvince(); $city = Sp_City_City::getChlidById($active['province']); $arrea = Sp_City_City::getChlidById($active['city']); $view = new Sp_View(); $uploadInfo = Util_FileUpload::getUpfileKey('huitong'); $view->assign('province', $province); $view->assign('city', $city); $view->assign('arrea', $arrea); $view->assign('uploadInfo', $uploadInfo); $view->assign('option', 'edit'); $view->assign('active', $active); $view->display("active/create.html"); } }
/** * 支付完成后返回处理(异步) * * @param array params * @return void */ public function notify($params) { $view = new Sp_View(); # 解析返回参数. $version = $params["version"]; $charset = $params["charset"]; $language = $params["language"]; $signType = $params["signType"]; $tranCode = $params["tranCode"]; $merchantID = $params["merchantID"]; $merOrderNum = $params["merOrderNum"]; $tranAmt = $params["tranAmt"]; $feeAmt = $params["feeAmt"]; $frontMerUrl = $params["frontMerUrl"]; $backgroundMerUrl = $params["backgroundMerUrl"]; $tranDateTime = $params["tranDateTime"]; $tranIP = $params["tranIP"]; $respCode = $params["respCode"]; $msgExt = $params["msgExt"]; $orderId = $params["orderId"]; $gopayOutOrderId = $params["gopayOutOrderId"]; $bankCode = $params["bankCode"]; $tranFinishTime = $params["tranFinishTime"]; $merRemark1 = $params["merRemark1"]; $merRemark2 = $params["merRemark2"]; $signValue = $params["signValue"]; # 判断返回签名是否正确(True/False) $bRet = Sp_Payment_Gopay_HttpClient::CheckHmac($version, $tranCode, $merchantID, $merOrderNum, $tranAmt, $feeAmt, $tranDateTime, $frontMerUrl, $backgroundMerUrl, $orderId, $gopayOutOrderId, $tranIP, $respCode, '', self::$verficationCode, $signValue); if ($bRet) { if ($respCode == '0000') { $sn = trim($merOrderNum); //订单号 $amount = floatval($tranAmt); //金额 $recharge_info = Sp_Trade_Recharge::getBySn($sn); $amount_num = 1; if (floatval($recharge_info['amount']) == $amount) { $ret = false; if ($recharge_info['status'] == 1) { $request = Request::current(); if ($request->isMobile()) { echo 'RespCode=0000|JumpURL=' . SP_URL_WAP . 'moneyrecord.html'; } else { echo 'RespCode=0000|JumpURL=' . SP_URL_USER . 'moneyrecord.html'; } exit; } elseif ($recharge_info['status'] < 1) { $amount_num = Sp_Trade_Recharge::getUserRechargeReport('WHERE status = 1 AND user_id=' . $recharge_info['user_id']); $param = array('id' => $recharge_info['id'], 'user_id' => $recharge_info['user_id'], 'sn' => $sn, 'amount' => $amount, 'bank_sn' => $_REQUEST['gopayOutOrderId'], 'trd_sn' => $_REQUEST['orderId'], 'remark' => json_encode($_REQUEST)); $ret = Sp_Trade_Tradeprocess::recharge($param); } if ($ret) { //处理成功 //首冲奖励 if ($amount_num == 0) { $active_send_info = array('uid' => $recharge_info['user_id'], 'type' => 'first_recharge'); $client_active = MQClient::factory('active'); $client_active->send('activePrizeReset_new_register', $active_send_info); } $user = Sp_Account_User::getUserBase($recharge_info['user_id']); //用户信息 $data = array('user_id' => $recharge_info['user_id'], 'account' => $amount, 'user_name' => $user->data["username"], 'email' => $user->data['email'], 'realname' => $user->data["username"], 'phone' => $user->data['phone']); Sp_Message::send('recharge', $data); //发送消息 $request = Request::current(); if ($request->isMobile()) { echo 'RespCode=0000|JumpURL=' . SP_URL_WAP . 'moneyrecord.html'; } else { echo 'RespCode=0000|JumpURL=' . SP_URL_USER . 'moneyrecord.html'; } } else { echo 'RespCode=9999|JumpURL='; $body = print_r($_REQUEST, true); Sp_Admin_Mail::send('*****@*****.**', '国付宝支付失败(数据库处理失败)', $body); } } } else { $body = print_r($_REQUEST, true); Sp_Admin_Mail::send('*****@*****.**', '国付宝支付失败(国付宝处理失败)', $body); echo 'RespCode=9999|JumpURL='; } } else { $body = print_r($_REQUEST, true); Sp_Admin_Mail::send('*****@*****.**', '国付宝支付失败(签名验证失败)', $body); echo 'RespCode=9999|JumpURL='; exit; } }
/** * 继承Smarty并设置项目的属性 */ function __construct($charset = 'UTF-8', $cur_skin = 'default') { //Class Constructor. These automatically get set with each new instance. method_exists('Smarty', 'Smarty') && $this->Smarty() || parent::__construct(); if (isset($cur_skin) && !empty($cur_skin)) { $this->_cur_skin = $cur_skin; } else { if (defined('VIEW_SKIN_CURRENT')) { $this->_cur_skin = VIEW_SKIN_CURRENT; } else { $this->_cur_skin = $this->_dft_skin; } } if (defined('VIEW_SKINS_ROOT')) { $this->_parent_dir = VIEW_SKINS_ROOT; } else { die("please set template skin dir first! "); } $this->template_dir = VIEW_SKINS_ROOT . $this->_cur_skin . '/'; //echo $this->template_dir; //$this->use_sub_dirs = true; $this->compile_id = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'local') . '_' . $this->_cur_skin; $this->compile_dir = VIEW_COMPILE_DIR; $this->config_dir = VIEW_CONFIG_DIR; $this->plugins_dir = array(LIB_ROOT . 'function/smarty/plugins', SMARTY_DIR . '/plugins'); // Smarty 的模板缓存,奇怪的设计,慎用 //$this->cache_dir = VIEW_CACHE_DIR; //$this->cache_lifetime = defined('VIEW_CACHE_LIFETIME') ? VIEW_CACHE_LIFETIME : 1440; //$this->clear_all_cache(); //$this->caching = defined('VIEW_CACHE_ENABLE') ? VIEW_CACHE_ENABLE : true; //$this->security = true; $this->use_sub_dirs = TRUE; //开启缓存目录分级 $this->left_delimiter = '{%'; $this->right_delimiter = '%}'; $this->_charset = $charset; new Sp_View_Helper($this); $this->assign_by_ref('head_title', $this->_head_title); $this->assign_by_ref('head_keywords', $this->_head_keywords); $this->assign_by_ref('head_description', $this->_head_description); $this->assign_by_ref('head_links', $this->_head_links); $this->assign_by_ref('head_styles', $this->_head_styles); $this->assign_by_ref('head_scripts', $this->_head_scripts); $this->assign_by_ref('foot_scripts', $this->_foot_scripts); $this->assign_by_ref('charset', $this->_charset); defined('SP_URL_API') && $this->assign('SP_URL_API', SP_URL_API); //API kong 增加 defined('SP_URL_HOME') && $this->assign('SP_URL_HOME', SP_URL_HOME); defined('SP_URL_CSS') && $this->assign('SP_URL_CSS', SP_URL_CSS); defined('SP_URL_IMG') && $this->assign('SP_URL_IMG', SP_URL_IMG); defined('SP_URL_JS') && $this->assign('SP_URL_JS', SP_URL_JS); defined('SP_URL_STO') && $this->assign('SP_URL_STO', SP_URL_STO); defined('SP_URL_CS') && $this->assign('SP_URL_CS', SP_URL_CS); defined('SP_URL_UPLOAD') && $this->assign('SP_URL_UPLOAD', SP_URL_UPLOAD); defined('SP_URL_FILE') && $this->assign('SP_URL_FILE', SP_URL_FILE); defined('SP_DOMAIN_SUFFIX') && $this->assign('SP_DOMAIN_SUFFIX', SP_DOMAIN_SUFFIX); defined('DATA_TYPE') && $this->assign('DATA_TYPE', DATA_TYPE); $this->assign('COOKIE_DOMAIN', Request::genCookieDomain()); // current request $this->_request = Request::current(); $this->assign_by_ref('_request', $this->_request); is_null($this->_parent_dir) && ($this->_parent_dir = CONF_ROOT . 'templates/'); if (is_dir($this->_parent_dir)) { $this->assign('parent_dir', $this->_parent_dir); } else { $this->assign('parent_dir', ''); } $user = Sp_Account_User::current(); if ($user->isLogin()) { $user = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area', 'mobile_status', 'email_status')); $this->assign('user', $user); } $this->assign('SP_COMPANY', SP_COMPANY); //公司名称 $this->assign('SP_INVEST_COMPANY', SP_INVEST_COMPANY); //网站名称 $this->default_template_handler_func = array($this, 'make_template'); }