card.ctrl.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. $dos = array('sign_display', 'sign', 'sign_record', 'notice', 'sign_strategy', 'share', 'mycard', 'add_recharge', 'addnums', 'recharge_record', 'receive_card', 'personal_info', 'consume');
  8. $do = in_array($do, $dos) ? $do : 'mycard';
  9. load()->model('user');
  10. load()->model('card');
  11. load()->func('tpl');
  12. activity_coupon_type_init();
  13. $notice_count = card_notice_stat();
  14. $setting = pdo_get('mc_card', array('uniacid' => $_W['uniacid']));
  15. if($do == 'sign_display') {
  16. $title = '签到-会员卡';
  17. $credit_set = card_credit_setting();
  18. $sign_set = $credit_set['sign'];
  19. $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_card_sign_record') . ' WHERE uniacid = :uniacid AND uid = :uid', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid']));
  20. $current_month_days = date('t', TIMESTAMP);
  21. $sign_rules = array(
  22. $sign_set['first_group_day'] => $sign_set['first_group_num'],
  23. $sign_set['second_group_day'] => $sign_set['second_group_num'],
  24. $sign_set['third_group_day'] => $sign_set['third_group_num'],
  25. $current_month_days => $sign_set['full_sign_num'],
  26. );
  27. if (!empty($sign_rules[$total])) {
  28. $today_sign_credit = $sign_rules[$total];
  29. } else {
  30. $today_sign_credit = $sign_set['everydaynum'];
  31. }
  32. if (!empty($sign_rules[$total + 1])) {
  33. $tomorrow_sign_credit = $sign_rules[$total + 1];
  34. $sign_credit = $sign_rules[$total + 1];
  35. } else {
  36. $tomorrow_sign_credit = $sign_set['everydaynum'];
  37. $sign_credit = $sign_set['everydaynum'];
  38. }
  39. $data = array(
  40. 'uniacid' => $_W['uniacid'],
  41. 'uid' => $_W['member']['uid'],
  42. 'credit' => $sign_credit,
  43. 'is_grant' => 0,
  44. 'addtime' => TIMESTAMP,
  45. );
  46. $today_signed = pdo_get('mc_card_sign_record', array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid'], 'addtime >' => strtotime(date('Y-m-d'))), 'id');
  47. if(empty($today_signed)) {
  48. $status = pdo_insert('mc_card_sign_record', $data);
  49. if (!empty($status) && $today_sign_credit > 0) {
  50. $log = "用户签到赠送【{$today_sign_credit}】积分";
  51. mc_credit_update($_W['member']['uid'], 'credit1', $today_sign_credit, array(0, $log, 'sign'));
  52. mc_notice_credit1($_W['openid'], $_W['member']['uid'], $today_sign_credit, $log);
  53. }
  54. $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_card_sign_record') . ' WHERE uniacid = :uniacid AND uid = :uid', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid']));
  55. }
  56. }
  57. if($do == 'sign_record') {
  58. $title = '签到记录-会员卡';
  59. $psize = 20;
  60. $pindex = max(1, intval($_GPC['page']));
  61. $period = intval($_GPC['period']);
  62. if ($period == '1') {
  63. $starttime = date('Ym01',strtotime(0));
  64. $endtime = date('Ymd His', time());
  65. } elseif($period == '0') {
  66. $starttime = date('Ym01', strtotime(1*$period . "month"));
  67. $endtime = date('Ymd', strtotime("$starttime + 1 month - 1 day"));
  68. } else {
  69. $starttime = date('Ym01', strtotime(1*$period . "month"));
  70. $endtime = date('Ymd', strtotime("$starttime + 1 month - 1 day"));
  71. }
  72. $where = '';
  73. $params = array();
  74. $where = ' WHERE `uniacid` = :uniacid AND `uid` = :uid AND `addtime` >= :starttime AND `addtime` < :endtime';
  75. $params[':uniacid'] = $_W['uniacid'];
  76. $params[':uid'] = $_W['member']['uid'];
  77. $params[':starttime'] = strtotime($starttime);
  78. $params[':endtime'] = strtotime($endtime);
  79. $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_card_sign_record') . $where, $params);
  80. $data = pdo_fetchall('SELECT * FROM ' . tablename('mc_card_sign_record') . $where . ' ORDER BY id DESC LIMIT ' . ($pindex - 1) * $psize . ", {$psize}", $params);
  81. $pagenums = ceil($total / $psize);
  82. foreach ($data as &$value) {
  83. $value['addtime'] = date('Y.m.d', $value['addtime']);
  84. }
  85. if($_W['isajax'] && $_W['ispost']) {
  86. if (!empty($data)){
  87. message(error(0, $data), '', 'ajax');
  88. } else {
  89. message(error(1, 'error'), '', 'ajax');
  90. }
  91. }
  92. }
  93. if($do == 'sign_strategy') {
  94. $set = card_credit_setting();
  95. $content = $set['content'];
  96. }
  97. if($do == 'notice') {
  98. $title = '系统消息-会员卡';
  99. if($_W['isajax']) {
  100. $id = intval($_GPC['id']);
  101. if($id > 0) {
  102. pdo_update('mc_card_notices_unread', array('is_new' => 0), array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid'], 'notice_id' => $id));
  103. $total = card_notice_stat();
  104. exit($total);
  105. }
  106. }
  107. $psize = 20;
  108. $pindex = max(1, intval($_GPC['page']));
  109. $type = intval($_GPC['type']) ? intval($_GPC['type']) : 1;
  110. $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_card_notices_unread') . ' WHERE uniacid = :uniacid AND uid = :uid AND type = :type', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':type' => $type));
  111. $data = pdo_fetchall('SELECT a.*,b.* FROM ' . tablename('mc_card_notices_unread') . ' AS a LEFT JOIN ' . tablename('mc_card_notices') . ' AS b ON a.notice_id = b.id WHERE a.uniacid = b.uniacid AND a.uniacid = :uniacid AND a.uid = :uid AND a.type = :type ORDER BY a.notice_id DESC LIMIT ' . ($pindex - 1) * $psize . ", {$psize}", array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':type' => $type));
  112. $pager = pagination($total, $pindex, $psize);
  113. }
  114. if ($do == 'receive_card') {
  115. $mcard = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid']), array('id'));
  116. if(!empty($mcard)) {
  117. header('Location:' . url('mc/card/mycard'));
  118. exit;
  119. }
  120. $sql = 'SELECT * FROM ' . tablename('mc_card') . " WHERE `uniacid` = :uniacid AND `status` = '1'";
  121. $setting = pdo_fetch($sql, array(':uniacid' => $_W['uniacid']));
  122. if (!empty($setting)) {
  123. $setting['color'] = iunserializer($setting['color']);
  124. $setting['background'] = iunserializer($setting['background']);
  125. $setting['fields'] = iunserializer($setting['fields']);
  126. $setting['grant'] = iunserializer($setting['grant']);
  127. if (!empty($setting['grant']['coupon']) && is_array($setting['grant']['coupon'])) {
  128. foreach ($setting['grant']['coupon'] as $grant_coupon) {
  129. $coupon_title .= "{$grant_coupon['couponTitle']}|";
  130. }
  131. }
  132. } else {
  133. message('公众号尚未开启会员卡功能', url('mc'), 'error');
  134. }
  135. if(!empty($setting['fields'])) {
  136. $fields = array('email');
  137. foreach($setting['fields'] as $li) {
  138. if($li['bind'] == 'birth') {
  139. $fields[] = 'birthyear';
  140. $fields[] = 'birthmonth';
  141. $fields[] = 'birthday';
  142. } elseif($li['bind'] == 'reside') {
  143. $fields[] = 'resideprovince';
  144. $fields[] = 'residecity';
  145. $fields[] = 'residedist';
  146. } else {
  147. $fields[] = $li['bind'];
  148. }
  149. }
  150. $member_info = mc_fetch($_W['member']['uid'], $fields);
  151. $reregister = 0;
  152. if(strlen($member_info['email']) == 39 && strexists($member_info['email'], '@we7.cc')) {
  153. $member_info['email'] = '';
  154. $reregister = 1;
  155. }
  156. }
  157. if ($_W['isajax'] && $_W['ispost']) {
  158. $data = array();
  159. $realname = trim($_GPC['realname']);
  160. if(empty($realname)) {
  161. message('请输入姓名', referer(), 'info');
  162. }
  163. $data['realname'] = $realname;
  164. $mobile = trim($_GPC['mobile']);
  165. if (!preg_match(REGULAR_MOBILE, $mobile)) {
  166. message('手机号有误', referer(), 'info');
  167. }
  168. $data['mobile'] = $mobile;
  169. if (!empty($setting['fields'])) {
  170. foreach ($setting['fields'] as $row) {
  171. if (!empty($row['require']) && ($row['bind'] == 'birth' || $row['bind'] == 'birthyear')) {
  172. if (empty($_GPC['birth']['year']) || empty($_GPC['birth']['month']) || empty($_GPC['birth']['day'])) {
  173. message('请输入出生日期', referer(), 'info');
  174. }
  175. $row['bind'] = 'birth';
  176. } elseif (!empty($row['require']) && $row['bind'] == 'resideprovince') {
  177. if (empty($_GPC['reside']['province']) || empty($_GPC['reside']['city']) || empty($_GPC['reside']['district'])) {
  178. message('请输入居住地', referer(), 'info');
  179. }
  180. $row['bind'] = 'reside';
  181. } elseif (!empty($row['require']) && empty($_GPC[$row['bind']])) {
  182. message('请输入'.$row['title'].'!', referer(), 'info');
  183. }
  184. $data[$row['bind']] = $_GPC[$row['bind']];
  185. }
  186. }
  187. $check = mc_check($data);
  188. if(is_error($check)) {
  189. message($check['message'], referer(), 'error');
  190. }
  191. $sql = 'SELECT COUNT(*) FROM ' . tablename('mc_card_members') . " WHERE `uid` = :uid AND `cid` = :cid AND uniacid = :uniacid";
  192. $count = pdo_fetchcolumn($sql, array(':uid' => $_W['member']['uid'], ':cid' => $_GPC['cardid'], ':uniacid' => $_W['uniacid']));
  193. if ($count >= 1) {
  194. message('已领取过该会员卡.', referer(), 'error');
  195. }
  196. $record = array(
  197. 'uniacid' => $_W['uniacid'],
  198. 'openid' => $_W['openid'],
  199. 'uid' => $_W['member']['uid'],
  200. 'cid' => $_GPC['cardid'],
  201. 'cardsn' => $data['mobile'],
  202. 'status' => '1',
  203. 'createtime' => TIMESTAMP,
  204. 'endtime' => TIMESTAMP
  205. );
  206. if(pdo_insert('mc_card_members', $record)) {
  207. if(!empty($data)){
  208. mc_update($_W['member']['uid'], $data);
  209. }
  210. $notice = '';
  211. if(is_array($setting['grant'])) {
  212. if($setting['grant']['credit1'] > 0) {
  213. $log = array(
  214. $_W['member']['uid'],
  215. "领取会员卡,赠送{$setting['grant']['credit1']}积分"
  216. );
  217. mc_credit_update($_W['member']['uid'], 'credit1', $setting['grant']['credit1'], $log);
  218. $notice .= "赠送【{$setting['grant']['credit1']}】积分";
  219. }
  220. if($setting['grant']['credit2'] > 0) {
  221. $log = array(
  222. $_W['member']['uid'],
  223. "领取会员卡,赠送{$setting['credit2']['credit1']}余额"
  224. );
  225. mc_credit_update($_W['member']['uid'], 'credit2', $setting['grant']['credit2'], $log);
  226. $notice .= ",赠送【{$setting['grant']['credit2']}】余额";
  227. }
  228. if (!empty($setting['grant']['coupon']) && is_array($setting['grant']['coupon'])) {
  229. foreach ($setting['grant']['coupon'] as $grant_coupon) {
  230. $status = activity_coupon_grant($grant_coupon['coupon'], $_W['member']['uid']);
  231. if(!is_error($status)) {
  232. $coupon_title .= ",{$grant_coupon['couponTitle']}";
  233. }
  234. }
  235. $notice .= ",赠送【{$coupon_title}】优惠券";
  236. }
  237. }
  238. $time = date('Y-m-d H:i');
  239. $url = murl('mc/card/mycard/', array(), true, true);
  240. $title = "【{$_W['account']['name']}】- 领取会员卡通知\n";
  241. $info = "您在{$time}成功领取会员卡,{$notice}。\n\n";
  242. $info .= "<a href='{$url}'>点击查看详情</a>";
  243. $status = mc_notice_custom_text($_W['openid'], $title, $info);
  244. message("领取会员卡成功", url('mc/card/mycard'), 'success');
  245. } else {
  246. message('领取会员卡失败.', referer(), 'error');
  247. }
  248. }
  249. }
  250. if ($do == 'mycard') {
  251. $mcard = pdo_fetch('SELECT * FROM ' . tablename('mc_card_members') . ' WHERE uniacid = :uniacid AND uid = :uid', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid']));
  252. $title = $setting['title'];
  253. if(empty($mcard)) {
  254. header('Location:' . url('mc/card/receive_card'));
  255. }
  256. if(empty($mcard['openid']) && !empty($_W['openid'])) {
  257. pdo_update('mc_card_members', array('openid' => $_W['openid']), array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid']));
  258. }
  259. if (!empty($mcard['status'])) {
  260. $setting = pdo_get('mc_card', array('uniacid' => $_W['uniacid']));
  261. if(!empty($setting)) {
  262. $setting['color'] = iunserializer($setting['color']);
  263. $setting['background'] = iunserializer($setting['background']);;
  264. }
  265. }
  266. load()->model('activity');
  267. $coupons = activity_coupon_owned();
  268. $nums_recharge = iunserializer($setting['nums']);
  269. $times_recharge = iunserializer($setting['times']);
  270. $total = count($coupons);
  271. load()->model('card');
  272. $activity_setting = card_params_setting('cardActivity');
  273. $notice_count = card_notice_stat();
  274. $params = json_decode($setting['params'], true);
  275. foreach ($params as $key => $value) {
  276. $params_new[$value['id']] = $value;
  277. }
  278. $activity_info = $params_new['cardActivity'];
  279. $recharge_info = $params_new['cardRecharge'];
  280. $nums_info = $params_new['cardNums'];
  281. $times_info = $params_new['cardTimes'];
  282. $activity_description_show = false;
  283. if ($activity_info['params']['discount_type'] != 0 || $recharge_info['params']['recharge_type'] != 0 || $nums_info['params']['nums_status'] != 0 || $times_info['params']['times_status'] != 0) {
  284. $activity_description_show = true;
  285. }
  286. }
  287. if ($do == 'activity_description') {
  288. $params = json_decode($setting['params'], true);
  289. foreach ($params as $key => $value) {
  290. $params_new[$value['id']] = $value;
  291. }
  292. $activity_info = $params_new['cardActivity'];
  293. $recharge_info = $params_new['cardRecharge'];
  294. $nums_info = $params_new['cardNums'];
  295. $times_info = $params_new['cardTimes'];
  296. if ($activity_info['params']['discount_type'] == 0 && $recharge_info['params']['recharge_type'] == 0 && $nums_info['params']['nums_status'] == 0 && $times_info['params']['times_status'] == 0) {
  297. message('暂无优惠信息', referer(), 'error');
  298. }
  299. if ($activity_info['params']['discount_type'] != 0) {
  300. foreach ($activity_info['params']['discounts'] as $key => $val) {
  301. $activity_description[$key][0] = $val['title'];
  302. if ($activity_info['params']['discount_type'] == 1) {
  303. if (!empty($val['condition_1']) && !empty($val['discount_1'])) {
  304. $activity_description[$key][1] = '消费 <span class="mui-badge mui-badge-danger">满</span> ' . $val['condition_1'] . ' 元,<span class="mui-badge mui-badge-danger">减</span> ' . $val['discount_1'] . ' 元';
  305. } else {
  306. unset($activity_description[$key]);
  307. }
  308. } else {
  309. if (!empty($val['condition_2']) && !empty($val['discount_2'])) {
  310. $activity_description[$key][1] = '消费 <span class="mui-badge mui-badge-danger">满</span> ' . $val['condition_2'] . ' 元,<span class="mui-badge mui-badge-danger">打</span>' . $val['discount_2'] . ' 折';
  311. } else {
  312. unset($activity_description[$key]);
  313. }
  314. }
  315. }
  316. }
  317. if ($recharge_info['params']['recharge_type'] == 1) {
  318. foreach ($recharge_info['params']['recharges'] as $key => $value) {
  319. if ($value['backtype'] == '0') {
  320. $recharge_description[$key] = '<span class="mui-badge mui-badge-danger">充</span> ' . $value['condition'] . ' 元,<span class="mui-badge mui-badge-danger">返</span> ' . $value['back'] . ' 元';
  321. } else {
  322. $recharge_description[$key] = '<span class="mui-badge mui-badge-danger">充</span> ' . $value['condition'] . ' 元,<span class="mui-badge mui-badge-danger">返</span> ' . $value['back'] . ' 积分';
  323. }
  324. }
  325. }
  326. if ($nums_info['params']['nums_status'] == 1) {
  327. foreach ($nums_info['params']['nums'] as $key => $value) {
  328. if (!empty($value['recharge']) && !empty($value['num'])) {
  329. $nums_description[$key] = '<span class="mui-badge mui-badge-danger">充</span> ' . $value['recharge'] . ' 元, ' . $value['num'] . ' 次';
  330. }
  331. }
  332. }
  333. if ($times_info['params']['times_status'] == 1) {
  334. foreach ($times_info['params']['times'] as $key => $value) {
  335. if (!empty($value['recharge']) && !empty($value['time'])) {
  336. $times_description[$key] = '<span class="mui-badge mui-badge-danger">充</span> ' . $value['recharge'] . ' 元, ' . $value['time'] . ' 天';
  337. }
  338. }
  339. }
  340. }
  341. if($do == 'add_recharge') {
  342. $type = trim($_GPC['type']);
  343. $mcard = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid']));
  344. $mcard['status'] = '1';
  345. if (!empty($mcard['status'])) {
  346. $setting = pdo_fetch('SELECT * FROM ' . tablename('mc_card') . ' WHERE uniacid = :uniacid', array(':uniacid' => $_W['uniacid']));
  347. $setting = iunserializer($setting[$type]);
  348. }
  349. }
  350. if($do == 'recharge_record') {
  351. $period = $_GPC['period'];
  352. $period_date = ($period == '1') ? date('Y.m', strtotime('now')) : date('Y.m', strtotime('now' . ($_GPC['period'] * 1) . ' month'));
  353. $starttime = ($period == '1') ? date('Ym01') : date('Ym01', strtotime(1*$period . "month"));
  354. $endtime = date('Ymd', strtotime("$starttime + 1 month - 1 day"));
  355. $setting = pdo_get('mc_card', array('uniacid' => $_W['uniacid']), array('nums_text', 'times_text'));
  356. $card = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid']));
  357. $type = trim($_GPC['type']);
  358. $where = ' WHERE uniacid = :uniacid AND uid = :uid AND type = :type AND addtime >= :starttime AND addtime <= :endtime';
  359. $params = array(
  360. ':uniacid' => $_W['uniacid'],
  361. ':uid' => $_W['member']['uid'],
  362. ':type' => $type,
  363. ':starttime' => strtotime($starttime),
  364. ':endtime' => strtotime($endtime)
  365. );
  366. $data = pdo_fetchall('SELECT * FROM ' . tablename('mc_card_record') . $where . ' ORDER BY id DESC ', $params);
  367. }
  368. if ($do == 'personal_info') {
  369. $setting = pdo_get('mc_card', array('uniacid' => $_W['uniacid'], 'status' => '1'));
  370. if (!empty($setting['fields'])) {
  371. $mc_fields = iunserializer($setting['fields']);
  372. foreach ($mc_fields as $key => &$row) {
  373. if (!empty($row['require']) && ($row['bind'] == 'birth' || $row['bind'] == 'birthyear') || $row['bind'] == 'birthday') {
  374. $row['bind'] = 'birth';
  375. } elseif (!empty($row['require']) && ($row['bind'] == 'resideprovince' || $row['bind'] == 'residecity' || $row['bind'] == 'residedist')) {
  376. $row['bind'] = 'reside';
  377. }
  378. if ($row['bind'] == 'mobile') {
  379. unset($mc_fields[$key]);
  380. }
  381. }
  382. }
  383. $profile = mc_fetch($_W['member']['uid']);
  384. $mcard = pdo_fetch('SELECT * FROM ' . tablename('mc_card_members') . ' WHERE uniacid = :uniacid AND uid = :uid', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid']));
  385. }
  386. if ($do == 'consume') {
  387. $card_settings = card_setting();
  388. $discount_params = $card_settings['discount'];
  389. $group = mc_fetch($_W['member']['uid'], array('groupid'));
  390. $stores = pdo_getall('activity_stores', array('uniacid' => $_W['uniacid'], 'source' => COUPON_TYPE, 'status' => '1'), array('id', 'business_name', 'branch_name'));
  391. $stores_data['data'] = array();
  392. if (!empty($stores) && is_array($stores)) {
  393. foreach ($stores as $key => $value) {
  394. $stores_data['data'][$key]['text'] = $value['business_name'];
  395. $stores_data['data'][$key]['value'] = $value['id'];
  396. if (!empty($value['branch_name'])) {
  397. $stores_data['data'][$key]['text'] = $value['business_name'] . '-' . $value['branch_name'];
  398. }
  399. }
  400. }
  401. if(checksubmit()) {
  402. $fee = trim($_GPC['fee']);
  403. $store_id = intval($_GPC['store_id']);
  404. $body = '会员卡消费' . $fee . '元';
  405. if (!empty($stores_data['data'])) {
  406. if (empty($store_id)) {
  407. message('请选择门店', '', 'error');
  408. }
  409. }
  410. if (empty($fee) || $fee <= 0) {
  411. message('收款金额有误', '', 'error');
  412. }
  413. $final_fee = card_discount_fee($fee);
  414. $data = array(
  415. 'uniacid' => $_W['uniacid'],
  416. 'clerk_id' => 0,
  417. 'clerk_type' => 3,
  418. 'store_id' => intval($_GPC['store_id']),
  419. 'body' => $body,
  420. 'fee' => $fee,
  421. 'final_fee' => $final_fee,
  422. 'credit_status' => 1,
  423. 'createtime' => TIMESTAMP,
  424. );
  425. pdo_insert('paycenter_order', $data);
  426. $id = pdo_insertid();
  427. header('Location:' . murl('entry', array('m' => 'paycenter', 'do' => 'pay', 'id' => $id), true, true));
  428. die;
  429. }
  430. template('mc/consume');
  431. exit();
  432. }
  433. template('mc/card');