public function fieldsFormSubmit($rid) { global $_GPC; $fid = $_GPC['fid']; $data = array('rid' => $rid, 'weid' => $this->weid, 'oname' => $_GPC['oname'], 'pname' => $_GPC['pname'], 'odesc' => htmlspecialchars_decode($_GPC['odesc']), 'p_desc' => htmlspecialchars_decode($_GPC['p_desc']), 'p_tel' => $_GPC['p_tel'], 'lng' => $_GPC['lng'], 'lat' => $_GPC['lat'], 'p_title_pg' => $_GPC['p_title_pg'], 'p_titile_url' => $_GPC['p_titile_url'], 'location_p' => $_GPC['location_p'], 'location_c' => $_GPC['location_c'], 'location_a' => $_GPC['location_a'], 'address' => $_GPC['address'], 'follow_url' => $_GPC['follow_url'], 'copyright' => $_GPC['copyright'], 'new_title' => $_GPC['new_title'], 'new_icon' => $_GPC['new_icon'], 'new_content' => $_GPC['new_content'], 'share_title' => $_GPC['share_title'], 'share_icon' => $_GPC['share_icon'], 'share_content' => $_GPC['share_content'], 'emailenable' => $_GPC['emailenable'], 'email' => $_GPC['email'], 'updatetime' => TIMESTAMP); if (empty($fid)) { $data['createtime'] = TIMESTAMP; DBUtil::create(DBUtil::$TABLE_ORDER_FORM, $data); } else { DBUtil::updateById(DBUtil::$TABLE_ORDER_FORM, $data, $fid); } return true; }
public function fieldsFormSubmit($rid) { global $_GPC; $egid = $_GPC['egid']; $data = array('rid' => $rid, 'weid' => $this->weid, 'title' => $_GPC['title'], 'starttime' => strtotime($_GPC['starttime']), 'endtime' => strtotime($_GPC['endtime']), 'follow_url' => $_GPC['follow_url'], 'copyright' => $_GPC['copyright'], 'follow_btn_name' => $_GPC['follow_btn_name'], 'follow_dlg_tip' => $_GPC['follow_dlg_tip'], 'new_title' => $_GPC['new_title'], 'new_icon' => $_GPC['new_icon'], 'new_content' => $_GPC['new_content'], 'share_title' => $_GPC['share_title'], 'share_icon' => $_GPC['share_icon'], 'share_content' => $_GPC['share_content'], 'intro' => htmlspecialchars_decode($_GPC['intro']), 'banner_bg' => $_GPC['banner_bg'], 'bg_img' => $_GPC['bg_img'], 'share_bg' => $_GPC['share_bg'], 'day_count' => $_GPC['day_count'], 'prize_limit' => $_GPC['prize_limit'], 'dpassword' => $_GPC['dpassword'], 'share_enable' => $_GPC['share_enable'], 'share_times' => $_GPC['share_times'], 'share_award_count' => $_GPC['share_award_count'], 'music' => $_GPC['music'], 'exchangeEnable' => $_GPC['exchangeEnable'], 'updatetime' => TIMESTAMP); if (empty($egid)) { $data['createtime'] = TIMESTAMP; DBUtil::create(DBUtil::$TABLE_EGG, $data); $egid = pdo_insertid(); } else { DBUtil::updateById(DBUtil::$TABLE_EGG, $data, $egid); } $prizids = array(); $pids = $_GPC['pids']; $display_orders = $_GPC['display_orders']; $plevels = $_GPC['plevels']; $pnames = $_GPC['pnames']; $pimgs = $_GPC['pimgs']; $ptypes = $_GPC['ptypes']; $jfs = $_GPC['jfs']; $pcounts = $_GPC['pcounts']; $pbs = $_GPC['pbs']; $pimgs = $_GPC['pimgs']; if (is_array($pids)) { foreach ($pids as $key => $value) { $value = intval($value); $d = array("egid" => $egid, "plevel" => $plevels[$key], 'display_order' => $display_orders[$key], 'pname' => $pnames[$key], 'pimg' => $pimgs[$key], 'pcount' => $pcounts[$key], 'ptype' => $ptypes[$key], 'pb' => $pbs[$key], 'jf' => $jfs[$key], "createtime" => TIMESTAMP); if (empty($value)) { DBUtil::create(DBUtil::$TABLE_EGG_PRIZE, $d); $prizids[] = pdo_insertid(); } else { DBUtil::updateById(DBUtil::$TABLE_EGG_PRIZE, $d, $value); $prizids[] = $value; } } if (count($prizids) > 0) { pdo_query("delete from " . tablename(DBUtil::$TABLE_EGG_PRIZE) . " where egid='{$egid}' and id not in (" . implode(",", $prizids) . ")"); } else { pdo_query("delete from " . tablename(DBUtil::$TABLE_EGG_PRIZE) . " where egid='{$egid}'"); } } return true; }
public function fieldsFormSubmit($rid) { global $_GPC, $_W; $kid = $_GPC['kid']; $kj_rules = array(); $rule_ids = $_GPC['rule_id']; $rule_prices = $_GPC['rule_pice']; $rule_start = $_GPC['rule_start']; $rule_end = $_GPC['rule_end']; if (is_array($rule_ids)) { foreach ($rule_ids as $key => $value) { $d = array('rule_pice' => $rule_prices[$key], 'rule_start' => $rule_start[$key], 'rule_end' => $rule_end[$key]); $kj_rules[] = $d; } } $data = array('rid' => $rid, 'weid' => $this->weid, 'title' => $_GPC['title'], 'starttime' => strtotime($_GPC['starttime']), 'endtime' => strtotime($_GPC['endtime']), 'p_name' => $_GPC['p_name'], 'p_kc' => $_GPC['p_kc'], 'p_y_price' => $_GPC['p_y_price'], 'p_low_price' => $_GPC['p_low_price'], 'p_pic' => $_GPC['p_pic'], 'p_preview_pic' => $_GPC['p_preview_pic'], 'yf_price' => $_GPC['yf_price'], 'follow_url' => $_GPC['follow_url'], 'copyright' => $_GPC['copyright'], 'new_title' => $_GPC['new_title'], 'new_icon' => $_GPC['new_icon'], 'new_content' => $_GPC['new_content'], 'share_title' => $_GPC['share_title'], 'share_icon' => $_GPC['share_icon'], 'share_content' => $_GPC['share_content'], 'p_url' => $_GPC['p_url'], 'copyright_url' => $_GPC['copyright_url'], 'hot_tel' => $_GPC['hot_tel'], 'p_intro' => htmlspecialchars_decode($_GPC['p_intro']), 'kj_dialog_tip' => $_GPC['kj_dialog_tip'], 'u_fist_tip' => $_GPC['u_fist_tip'], 'u_already_tip' => $_GPC['u_already_tip'], 'rank_tip' => $_GPC['rank_tip'], 'fk_fist_tip' => $_GPC['fk_fist_tip'], 'fk_already_tip' => $_GPC['fk_already_tip'], 'pay_type' => $_GPC['pay_type'], 'p_model' => $_GPC['p_model'], 'kj_rule' => serialize($kj_rules), 'createtime' => TIMESTAMP); if (empty($kid)) { DBUtil::create(DBUtil::$TABLE_WKJ, $data); } else { DBUtil::updateById(DBUtil::$TABLE_WKJ, $data, $kid); } return true; }
/** * author: 微赞科技 * 用户分享 */ public function doMobileUserShare() { global $_W, $_GPC; $egid = $_GPC['egid']; $egg = DBUtil::findById(DBUtil::$TABLE_EGG, $egid); $openid = $this->getOpenId(); if (!empty($egg) && $egg['share_enable'] == 1 && !empty($openid)) { $user = DBUtil::findUnique(DBUtil::$TABLE_EGG_USER, array(":egid" => $egid, ":openid" => $openid)); if (!empty($user)) { $user_DayShare = $this->findUserDayShareCount($egg['id'], $openid); $userDayCount = $this->findUserDayRecordCount($egg['id'], $openid); //查找用户今天的次数 //分享奖励次数还有,并且 用户抽奖次数大于等于 每天限制基本次数 if ($user_DayShare < $egg['share_times'] && $userDayCount >= $egg['day_count']) { $shareData = array('egid' => $egid, 'uid' => $user['id'], 'openid' => $openid, 'createtime' => TIMESTAMP); DBUtil::create(DBUtil::$TABLE_EGG_SHARE, $shareData); die(json_encode(array('code' => 250, 'leftShare' => $egg['share_times'] - 1 - $user_DayShare, 'awardCount' => $egg['share_award_count']))); } } } die(json_encode(array('code' => 200))); }
/** * author: 微赞 * 提交订单 */ public function doMobileSubmitOrder() { global $_W, $_GPC; $fid = $_GPC['fid']; $iid = $_GPC['iid']; $orderItem = DBUtil::findById(DBUtil::$TABLE_ORDER_ITEM, $iid); $form = DBUtil::findById(DBUtil::$TABLE_ORDER_FORM, $fid); $res = array(); if (empty($orderItem)) { $res['code'] = 500; $res['msg'] = '订单项目删除或不存在'; die(json_encode($res)); } if (empty($form)) { $res['code'] = 501; $res['msg'] = '订单不删除或不存在'; die(json_encode($res)); } $openid = $_W['fans']['from_user']; //$openid = "o_-Hajq-MxgT-pvJX7gRMswH8_eM"; if (empty($_W['fans']['follow'])) { $res['code'] = 5021; $res['msg'] = '请关注公众账号后再进行提交订单哦!'; die(json_encode($res)); } if (empty($openid)) { $res['code'] = 502; $res['msg'] = '请关注公众账号后再进行提交订单哦!'; die(json_encode($res)); } $dbOrder = $this->findOrder($iid, $openid); if (!empty($dbOrder)) { $res['code'] = 503; $res['msg'] = '已经提交过订单,请不要重复提交哦!'; die(json_encode($res)); } $alreadyOrderNum = $this->findTotalOrderNum($iid); $orderNum = $_GPC['ordernum']; if ($orderItem['o_num'] - $alreadyOrderNum <= 0) { $res['code'] = 503; $res['msg'] = '数量已经没有了,下次再来预定吧!'; die(json_encode($res)); } if ($orderNum > $orderItem['o_num'] - $alreadyOrderNum) { $res['code'] = 504; $res['msg'] = '您的数量已经超出了剩余数量,请重写填写数量!'; die(json_encode($res)); } $ordertime = strtotime($_GPC['ordertime']); $userInfo = $this->getClientUserInfo($openid); $zf_price = $orderItem['x_price'] * $orderNum; if ($orderItem['pay_type'] == $this::$PAY_ONLINE) { //在线支付 $status = $this::$STATUS_UNPAY; } else { if ($orderItem['pay_type'] == $this::$PAY_OFFLINE) { //线下支付 $status = $this::$STATUS_OVER; } } $orderno = date("YmdHis", TIMESTAMP); $orderData = array('fid' => $fid, 'orderno' => $orderno, 'iid' => $iid, 'acid' => $_W['acid'], 'openid' => $openid, 'nickname' => $userInfo['nickname'], 'headimgurl' => $userInfo['headimgurl'], 'uname' => $_GPC['uname'], 'utel' => $_GPC['utel'], 'ordertime' => $ordertime, 'ordernum' => $orderNum, 'o_yprice' => $orderItem['y_price'], 'o_xprice' => $orderItem['x_price'], 'zf_price' => $zf_price, 'pay_type' => $orderItem['pay_type'], 'remark' => $_GPC['remark'], 'status' => $status, 'createtime' => TIMESTAMP); DBUtil::create(DBUtil::$TABLE_ORDER_ORDER, $orderData); $oid = pdo_insertid(); $res['code'] = 200; $res['oid'] = $oid; $this->sendOrderTemplateMsg($orderData, $orderItem, $form); $this->sendEmail($orderData, $orderItem, $form); die(json_encode($res)); }
/** * author: codeMonkey QQ:631872807 * 设置 */ public function doWebKjSetting() { global $_GPC, $_W; $kjsetting = DBUtil::findUnique(DBUtil::$TABLE_WKJ_SETTING, array(':weid' => $this->weid)); if (checksubmit('submit')) { $data = array('weid' => $this->weid, 'appid' => trim($_GPC['appid']), 'appsecret' => trim($_GPC['appsecret']), 'mchid' => trim($_GPC['mchid']), 'shkey' => trim($_GPC['shkey'])); if (!empty($kjsetting)) { DBUtil::updateById(DBUtil::$TABLE_WKJ_SETTING, $data, $kjsetting['id']); } else { DBUtil::create(DBUtil::$TABLE_WKJ_SETTING, $data); } message('参数设置成功!', $this->createWebUrl('KjSetting', array('op' => 'display')), 'success'); } include $this->template("kjsetting"); }