/** * Creates a new MOrder model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new MOrder(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->order_id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCreate() { $model = new MOrder(); if (\Yii::$app->request->isPost) { $model->load(\Yii::$app->request->post()); if ($model->save()) { return $this->redirect(['index']); } else { U::W($model->getErrors()); } } return $this->render('create', ['model' => $model]); }
public function actionGoodssave() { $this->layout = false; $gh_id = U::getSessionParam('gh_id'); $openid = U::getSessionParam('openid'); Yii::$app->wx->setGhId($gh_id); $order = new MOrder(); $order->oid = MOrder::generateOid(); $order->gh_id = $gh_id; $order->openid = $openid; $order->cid = $_GET["cid"]; $good = MGoods::findOne(['goods_id' => $order->cid]); $order->title = $good->title; //利用该字段做一个标记,在myorder 页面中兼容老的商品表item。 $order->attr = 'goods'; $order->val_pkg_3g4g = isset($_GET['pkg3g4g']) ? $_GET['pkg3g4g'] : ''; $order->val_pkg_period = isset($_GET['pkgPeriod']) ? $_GET['pkgPeriod'] : 0; $order->val_pkg_monthprice = isset($_GET['pkgMonthprice']) ? $_GET['pkgMonthprice'] : 0; $order->val_pkg_plan = isset($_GET['pkgPlan']) ? $_GET['pkgPlan'] : ''; //$order->feesum = $_GET['feeSum'] * 100; $order->feesum = $_GET['feeSum'] * 100; $order->office_id = isset($_GET['office']) && $_GET['office'] != MOrder::NO_CHOICE ? $_GET['office'] : 0; $order->userid = isset($_GET['userid']) && $_GET['userid'] != MOrder::NO_CHOICE ? $_GET['userid'] : ''; $order->username = isset($_GET['username']) && $_GET['username'] != MOrder::NO_CHOICE ? $_GET['username'] : ''; $order->usermobile = isset($_GET['usermobile']) && $_GET['usermobile'] != MOrder::NO_CHOICE ? $_GET['usermobile'] : ''; //$order->pay_kind = isset($_GET['pay_kind']) ? $_GET['pay_kind'] : MOrder::PAY_KIND_CASH; $order->address = isset($_GET['address']) && $_GET['address'] != MOrder::NO_CHOICE ? $_GET['address'] : ''; $order->kaitong = isset($_GET['kaitong']) && $_GET['kaitong'] != MOrder::NO_CHOICE ? $_GET['kaitong'] : ''; $order->memo = isset($_GET['memo']) && $_GET['memo'] != MOrder::NO_CHOICE ? $_GET['memo'] : ''; $order->detail = $order->getDetailStr(); /* if ($_GET['selectNum'] != MOrder::NO_CHOICE) { $order->select_mobnum = $_GET['selectNum']; $mobnum = MMobnum::findOne($_GET['selectNum']); if ($mobnum === null || $mobnum->status != MMobnum::STATUS_UNUSED) { return json_encode(['status' => 1, 'errmsg' => $mobnum === null ? "mobile doest not exist" : "mobile locked!"]); } } else { $order->select_mobnum = ''; } */ $order->select_mobnum = ''; /* $wid = Yii::$app->request->get('wid', ''); if (!empty($wid)) { list($scene_id, $scene_src_id) = explode('_', $wid); $order->scene_id = $scene_id; $order->scene_src_id = $scene_src_id; if (empty($order->item)) { U::W("@@@@@@@@@@@@@@@@@@@NULL@@@@@@@@@@@@@@@@@@@@@@@@@@@"); } $order->scene_amt = $order->feesum * $order->item->scene_percent / 100; } */ if ($order->save(false)) { //send wx message and sm $manager = MStaff::findOne(['office_id' => $order->office_id, 'is_manager' => 1]); if ($manager !== null && !empty($manager->openid)) { //U::W('sendWxm'); $manager->sendWxm($order->getWxNoticeToManager()); //U::W('sendSm'); //$manager->sendSm($order->getSmNoticeToManager()); try { $arr = $order->sendTemplateNoticeToManager($manager); } catch (\Exception $e) { U::W($e->getMessage()); } } else { U::W(['Have no manager or the manager has not binded openid', $order]); } /* // send wx message to user //$arr = Yii::$app->wx->WxMessageCustomSend(['touser'=>$openid, 'msgtype'=>'text', 'text'=>['content'=>$order->getWxNotice()]]); $arr = $order->sendTemplateNoticeToCustom(); */ } else { U::W([__METHOD__, $order->getErrors()]); } $jsApiParameters = $order->GetOrderJsApiParameters(); return json_encode(['oid' => $order->oid, 'status' => 0, 'pay_url' => $jsApiParameters]); }
public function actionProdsave() { $this->layout = false; $gh_id = U::getSessionParam('gh_id'); $openid = U::getSessionParam('openid'); Yii::$app->wx->setGhId($gh_id); $order = new MOrder(); $order->oid = MOrder::generateOid(); $order->gh_id = $gh_id; $order->openid = $openid; $order->cid = $_GET["cid"]; switch ($_GET["cid"]) { case MItem::ITEM_CAT_DIY: $order->title = '自由组合套餐'; $order->attr = "{$_GET['cardType']},{$_GET['flowPack']},{$_GET['voicePack']},{$_GET['msgPack']},{$_GET['callshowPack']},{$_GET['otherPack']}"; break; case MItem::ITEM_CAT_CARD_WO: $order->title = '微信沃卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_XIAOYUAN: $order->title = '沃派校园套餐'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_IPHONE4S: $order->title = 'Apple iPhone4s'; $order->attr = "{$_GET['modelColor']}, {$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_K1: $order->title = 'K1'; $order->attr = "{$_GET['modelColor']}, {$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_HTC516: $order->title = 'HTC516'; $order->attr = "{$_GET['modelColor']}, {$_GET['prom']}"; break; case MItem::ITEM_CAT_GOODNUMBER: $order->title = '精选靓号'; $order->attr = "{$_GET['planFlag']}, {$_GET['plan66']}, {$_GET['plan96']}, {$_GET['plan126']}"; break; case MItem::ITEM_CAT_MOBILE_APPLE_5C_8G_WHITE: $order->title = '苹果5C 8G 白色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_APPLE_5C_8G_BLUE: $order->title = '苹果5C 8G 蓝色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_HTC_8160_SILVER: $order->title = 'HTC 8160 银色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_SAMSUNG_7506V_BLACK: $order->title = '三星 7506V 黑色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_COOLPAD_7298A_CHUNLEI_WHITE: $order->title = '酷派 7298A 春雷 白色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_LENOVOA_A850_BLACK: $order->title = '联想 A850+ 黑色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_COOLPAD_7295C_WHITE: $order->title = '酷派 7295C 白色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_APPLE_5S_32G_SILVER: $order->title = '苹果 5S 32G 银色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_COOLPAD_7296_BLACK: $order->title = '酷派 7296 黑色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_COOLPAD_7296_WHITE: $order->title = '酷派 7296 白色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_COOLPAD_K1_WHITE: $order->title = '酷派 K1 白色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_COOLPAD_7235_BLACK: $order->title = '酷派 7235 黑色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_COOLPAD_7230S_BLACK: $order->title = '酷派 7230S 黑色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_HISENSE_U939: $order->title = '海信 U939'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_COOLPAD_7295C_BLACK: $order->title = '酷派 7295C 黑色'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_XIAOMI4: $order->title = '小米4'; $order->attr = "{$_GET['prom']}"; break; //双十一活动 手机 begin //---------------------------------------------------------- //ITEM_CAT_MOBILE_IPHONE4S iPhone 4S 8GB GSM =12 //ITEM_CAT_MOBILE_HUAWEI_HONOR_6_WHITE 荣耀6 =328 //ITEM_CAT_MOBILE_XIAOMI4 小米4 =331 //const ITEM_CAT_APPLE_5S_16G = 332; //const ITEM_CAT_APPLE_6_16G = 333; //const ITEM_CAT_MOBILE_XIAOMI_HM_NOTE = 334; //const ITEM_CAT_MOBILE_SONY_S55U = 335; //const ITEM_CAT_MOBILE_XIAOMI_HM_1S = 336; //双十一活动 手机 begin //---------------------------------------------------------- //ITEM_CAT_MOBILE_IPHONE4S iPhone 4S 8GB GSM =12 //ITEM_CAT_MOBILE_HUAWEI_HONOR_6_WHITE 荣耀6 =328 //ITEM_CAT_MOBILE_XIAOMI4 小米4 =331 //const ITEM_CAT_APPLE_5S_16G = 332; //const ITEM_CAT_APPLE_6_16G = 333; //const ITEM_CAT_MOBILE_XIAOMI_HM_NOTE = 334; //const ITEM_CAT_MOBILE_SONY_S55U = 335; //const ITEM_CAT_MOBILE_XIAOMI_HM_1S = 336; case MItem::ITEM_CAT_APPLE_5S_16G: $order->title = 'APPLE 苹果 iPhone5S'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_APPLE_6_16G: $order->title = 'APPLE 苹果 iPhone6'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_HUAWEI_HONOR_6_WHITE: $order->title = '华为HuaWei 荣耀6'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_XIAOMI_HM_NOTE: $order->title = '红米Note'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_SONY_S55U: $order->title = 'SONY 索尼 S55u'; $order->attr = "{$_GET['prom']}"; break; case MItem::ITEM_CAT_MOBILE_XIAOMI_HM_1S: $order->title = '红米1S'; $order->attr = "{$_GET['prom']}"; break; // 双十一活动 手机 end // 双十一活动 手机 end case MItem::ITEM_CAT_CARD_45GLIULIANG: $order->title = '45G包年流量套餐'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_96GLIULIANG: $order->title = '96G包年流量套餐'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_120GLIULIANG: $order->title = '120G流量上网卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_240GLIULIANG: $order->title = '240G流量上网卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_60YUANBAO5G_SHANGWANGKA: $order->title = '60元包5G上网卡'; $order->attr = "{$_GET['cardType']}"; break; //双十一活动 上网卡 begin //---------------------------------------------------------- //const ITEM_CAT_CARD_1111_200YUAN_BENDI_5GLIULIANG = 708; //const ITEM_CAT_CARD_1111_3GLIULIANG = 709; //const ITEM_CAT_CARD_1111_6GLIULIANG = 710; //const ITEM_CAT_CARD_1111_100YUAN_BENDI_5GLIULIANG = 711; //const ITEM_CAT_CARD_1111_45GLIULIANG = 712; //const ITEM_CAT_CARD_1111_96GLIULIANG = 713; //双十一活动 上网卡 begin //---------------------------------------------------------- //const ITEM_CAT_CARD_1111_200YUAN_BENDI_5GLIULIANG = 708; //const ITEM_CAT_CARD_1111_3GLIULIANG = 709; //const ITEM_CAT_CARD_1111_6GLIULIANG = 710; //const ITEM_CAT_CARD_1111_100YUAN_BENDI_5GLIULIANG = 711; //const ITEM_CAT_CARD_1111_45GLIULIANG = 712; //const ITEM_CAT_CARD_1111_96GLIULIANG = 713; case MItem::ITEM_CAT_CARD_1111_200YUAN_BENDI_5GLIULIANG: $order->title = '200元本地流量卡5G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_1111_3GLIULIANG: $order->title = '3G半年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_1111_6GLIULIANG: $order->title = '6G年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_1111_100YUAN_BENDI_5GLIULIANG: $order->title = '100元本地流量卡5G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_1111_45GLIULIANG: $order->title = '45G包年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_1111_96GLIULIANG: $order->title = '96G包年卡'; $order->attr = "{$_GET['cardType']}"; break; //双十一活动 上网卡 end //双十一活动 上网卡 end case MItem::ITEM_KIND_INTERNET_CARD_FLOW100MB: $order->title = '10元包100MB 3G省内流量包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW300MB: $order->title = '20元包300MB 3G省内流量包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW500MB: $order->title = '30元包500MB 3G省内流量包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW1GB_1: $order->title = '50元包1G 3G省内流量包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW2DOT5GB: $order->title = '100元包2.5G 3G省内流量包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW1GB_2: $order->title = '100元包1G 全国流量半年包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW_FREE: $order->title = '拼人品 抢流量包'; $order->attr = "{$_GET['cardType']}"; $ar = MOrder::find()->where("gh_id = :gh_id AND usermobile = :usermobile AND cid = :cid", [':gh_id' => $gh_id, ':usermobile' => $_GET["usermobile"], ':cid' => $_GET["cid"]])->one(); if ($ar !== null) { //U::W([$_GET, $_POST, $ar->getErrors()]); //Yii::$app->session->setFlash('success','手机号码已参加!'); //return $this->refresh(); return; } $user_founder = MWinMobileNum::findOne(['gh_id' => $gh_id, 'openid' => $openid]); $user_founder->finished = 1; $user_founder->save(); break; case MItem::ITEM_KIND_INTERNET_CARD_300YUANSHICHANGBANNIANKA: $order->title = '300元时长半年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_600YUANSHICHANGNIANKA: $order->title = '600元时长年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_1200YUANSHICHANGNIANKA: $order->title = '1200元时长年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_SXYW_WKHB: $order->title = '沃看湖北可看在线卫视及各种栏目10元包6G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_SXYW_AIQIYI10: $order->title = '爱奇艺内容丰富10元包2.5G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_SXYW_AIQIYI15: $order->title = '爱奇艺内容丰富15元包6G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_SXYW_PPTV: $order->title = 'PPTV无广告流畅收看内容丰富15元包6G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_LYJHXJ: $order->title = '老友季焕新机'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_D12_IPHONE6: $order->title = '苹果iPhone6'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_D12_HONGMI_NOTE: $order->title = '红米Note'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_D12_HUAWEI_MATE7: $order->title = '华为Mate7'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_D12_45G_SHANGWANGKA: $order->title = '45G上网卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_D12_96G_SHANGWANGKA: $order->title = '96G上网卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_4GTAOCAN: $order->title = '4G套餐'; $order->attr = "{$_GET['cardType']}"; break; //doubledan //doubledan case MItem::ITEM_CAT_CARD_DD_100YUAN5G_SHANGWANGKA: $order->title = '100元本地流量卡5G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_DD_3GBANNIAN_SHANGWANGKA: $order->title = '3G半年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_DD_6GNIANKA_SHANGWANGKA: $order->title = '6G年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_4GQGSJTC6GBNB: $order->title = '4G全国数据套餐6G半年包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_4GQGSJTC12GBNB: $order->title = '4G全国数据套餐12G半年包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_4GQGSJTC17GBNB: $order->title = '4G省内数据套餐17G半年包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_45GBNLLTC: $order->title = '45G包年流量套餐'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_CARD_600YSCNK: $order->title = '600元时长年卡'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_DD_IPHONE4S: $order->title = '苹果 iPhone4S'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_DD_IPHONE5S: $order->title = '苹果 iPhone5S 16GB'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_DD_HONOR6: $order->title = '华为荣耀6'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_DD_XIAOMI4: $order->title = '小米4'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_DD_SAMSUNGG5108Q: $order->title = '三星G5108Q'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_DD_SAMSUNGNOTE3: $order->title = '三星Note3'; $order->attr = "{$_GET['cardType']}"; break; //购机有优惠 2015-3-20 //购机有优惠 2015-3-20 case MItem::ITEM_CAT_MOBILE_OPPOR830S: $order->title = 'OPPO R830S'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LIANGXIANGA399: $order->title = '联想 A399'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_ZHONGXINGV5: $order->title = '中兴 V5'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_HONGMI2: $order->title = '红米2'; $order->attr = "{$_GET['cardType']}"; break; //双4G双百兆手机 //双4G双百兆手机 case MItem::ITEM_CAT_MOBILE_MEILANNOTE_16G: $order->title = '魅蓝note 16G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_MEIZUMX4_16G: $order->title = '魅族 MX4'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_IPHONE6_16G: $order->title = 'iPhone6 16G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_IPHONE6PLUS_16G: $order->title = 'iPhone6 Plus 16G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_IPHONE6_64G: $order->title = 'iPhone6 64G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_IPHONE6_128G: $order->title = 'iPhone6 128G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_IPHONE6PLUS_64G: $order->title = 'iPhone6 Plus 64G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_ZHONGXINGV5S: $order->title = '中兴V5S'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_HUAWEI_MT7: $order->title = '华为 Mate7'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4GSJFKZJ_IPHONE4S_8G: $order->title = 'iPhone4S 8G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4GSJFKZJ_IPHONE5C_8G: $order->title = 'iPhone5C 8G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4GSJFKZJ_IPHONE6_16G: $order->title = 'iPhone6 16G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4GSJFKZJ_SANXING_G5108Q: $order->title = '三星 G5108Q'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4GSJFKZJ_SANXING_9006V: $order->title = '三星 9006V'; $order->attr = "{$_GET['cardType']}"; break; //双4G双百兆手机 5.1 活动 //双4G双百兆手机 5.1 活动 case MItem::ITEM_CAT_MOBILE_4G_LIANGXIANG_A3600: $order->title = '联想A3600'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_KUPAI_7061: $order->title = '酷派7061'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_KUPAI_Y76: $order->title = '酷派y76'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_XIAOMI_4G: $order->title = '小米4(4G)'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_HTC_820U: $order->title = 'HTC 820U'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_IPHONE6_16G: $order->title = 'iPhone6 (16G)'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_SANXING_N9106W: $order->title = '三星N9106W'; $order->attr = "{$_GET['cardType']}"; break; //双4G双百兆手机 7.22 cid from 4000 //双4G双百兆手机 7.22 cid from 4000 case MItem::ITEM_CAT_MOBILE_4G_KAMEIOU_C6: $order->title = '卡美欧 C6'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_FEIXUN_C630LW: $order->title = '斐讯 C630Lw'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_TCL_P502U: $order->title = 'TCL P502U'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_FEIXUN_E653: $order->title = '斐讯 E653'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_XIAOLAJIAO_LA2S: $order->title = '小辣椒 LA2S'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_IPHONE6PLUS_16G: $order->title = 'iPhone6 Plus 16G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_4G_IPHONE6S: $order->title = 'iPhone6s'; $order->attr = "{$_GET['cardType']}"; break; //老用户户专享 参与机型及优惠合约 //老用户户专享 参与机型及优惠合约 case MItem::ITEM_CAT_MOBILE_SANXIN_SM_G9006VW: $order->title = '三星SM-G9006V/W'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_HTC_ONE: $order->title = 'HTC One'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_ZHONGXING_Q801U: $order->title = '中兴 Q801U'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LIANXIANG_A606: $order->title = '联想A606'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_ZHONGXINGV5S_1: $order->title = '中兴V5S'; $order->attr = "{$_GET['cardType']}"; break; //老用户户专享 6.18 //老用户户专享 6.18 case MItem::ITEM_CAT_MOBILE_LYH_IPHONE6PLUS_128GB: $order->title = 'iPhone6+ 128G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_KUPAI_Y76: $order->title = '酷派 Y76'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_XIAOMI4_4G: $order->title = '小米手机4 联通4G'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_HONGMI2_4G: $order->title = '红米手机2 联通4G双卡版'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_HONGMINOTE_4G: $order->title = '红米NOTE 4G双卡双待'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_CFSF: $order->title = '存费送费 5折优惠'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_CFSYW: $order->title = '存费送业务 5折优惠'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LESHI1: $order->title = '乐视(Letv)乐1'; $order->attr = "{$_GET['cardType']}"; break; //老用户户专享 6.18 end //6.30 //老用户户专享 6.18 end //6.30 case MItem::ITEM_CAT_MOBILE_LYH_KUPAI_K1: $order->title = '酷派K1 (7260)'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_HUAWEI_MT7: $order->title = '华为MT7'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_LESHI1: $order->title = '乐视乐1'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_RONGYAO_4X_HI: $order->title = '荣耀4X(高配版)'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_RONGYAO_4X_ST: $order->title = '荣耀4X(标配版)'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_IPHONE4S_8GB: $order->title = 'iPhone4S 8GB'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_IPHONE5S_16GB: $order->title = 'iPhone5S 16GB'; $order->attr = "{$_GET['cardType']}"; break; //6.30 end //6.30 end case MItem::ITEM_CAT_MOBILE_LYH_HTC_8160: $order->title = 'HTC 8160'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_SAMSUNG_N9006: $order->title = '三星SM-N9006'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_KUPAI_7296: $order->title = '酷派 7296'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_MOBILE_LYH_IPHONE_64G: $order->title = 'iPhone6 64G 灰色'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW100MB_GUONEI: $order->title = '10元包100M 3G国内流量包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW300MB_GUONEI: $order->title = '20元包300M 3G国内流量包'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_INTERNET_CARD_FLOW500MB_GUONEI: $order->title = '30元包500M 3G国内流量包'; $order->attr = "{$_GET['cardType']}"; break; //惠购流量包 begin //惠购流量包 begin case MItem::ITEM_CAT_HGLLB_3G_GN_10Y100M: $order->title = '3G国内流量 10元 100M'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_3G_GN_20Y300M: $order->title = '3G国内流量 20元 300M'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_3G_GN_30Y500M: $order->title = '3G国内流量 30元 500M'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_3G_SN_10Y100M: $order->title = '3G省内流量 10元 100M'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_3G_SN_20Y300M: $order->title = '3G省内流量 20元 300M'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_3G_SN_30Y500M: $order->title = '3G省内流量 30元 500M'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_WO_PPTV: $order->title = 'Wo+视频 PPTV定向流量包月'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_KG: $order->title = '酷狗'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_LHTX: $order->title = '漏话提醒'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_KJTX: $order->title = '开机提醒'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HGLLB_4G_SN_BNB: $order->title = '4G省内半年包(100元包1.5G)'; $order->attr = "{$_GET['cardType']}"; break; //惠购流量包 end //惠购流量包 end case MItem::ITEM_CAT_HD_XYYHJ: $order->title = '校园优惠季'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_HD_LLB: $order->title = '流量宝'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_KIND_ZZYW: $order->title = '增值业务'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_KDTH_10MTC: $order->title = '智慧沃家 10M套餐'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_KDTH_20MTC: $order->title = '智慧沃家 20M套餐'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_KDTH_50MTC: $order->title = '智慧沃家 50M套餐'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_KDTH_100MTCA: $order->title = '智慧沃家 100M套餐A'; $order->attr = "{$_GET['cardType']}"; break; case MItem::ITEM_CAT_KDTH_100MTCB: $order->title = '智慧沃家 100M套餐B'; $order->attr = "{$_GET['cardType']}"; break; default: U::W(['invalid data cat', $_GET["cid"], __METHOD__, $_GET]); return; } $order->val_pkg_3g4g = isset($_GET['pkg3g4g']) ? $_GET['pkg3g4g'] : ''; $order->val_pkg_period = isset($_GET['pkgPeriod']) ? $_GET['pkgPeriod'] : 0; $order->val_pkg_monthprice = isset($_GET['pkgMonthprice']) ? $_GET['pkgMonthprice'] : 0; $order->val_pkg_plan = isset($_GET['pkgPlan']) ? $_GET['pkgPlan'] : ''; $order->feesum = $_GET['feeSum'] * 100; //订购流量包时,不需用户选择营业厅, 直接指定新华路营业厅 if ($_GET["cid"] == 702 || $_GET["cid"] == 703 || $_GET["cid"] == 704) { $order->office_id = 16; } else { $order->office_id = isset($_GET['office']) && $_GET['office'] != MOrder::NO_CHOICE ? $_GET['office'] : 0; } $order->userid = isset($_GET['userid']) && $_GET['userid'] != MOrder::NO_CHOICE ? $_GET['userid'] : ''; $order->username = isset($_GET['username']) && $_GET['username'] != MOrder::NO_CHOICE ? $_GET['username'] : ''; $order->usermobile = isset($_GET['usermobile']) && $_GET['usermobile'] != MOrder::NO_CHOICE ? $_GET['usermobile'] : ''; //$order->pay_kind = isset($_GET['pay_kind']) ? $_GET['pay_kind'] : MOrder::PAY_KIND_CASH; $order->address = isset($_GET['address']) && $_GET['address'] != MOrder::NO_CHOICE ? $_GET['address'] : ''; $order->kaitong = isset($_GET['kaitong']) && $_GET['kaitong'] != MOrder::NO_CHOICE ? $_GET['kaitong'] : ''; $order->memo = isset($_GET['memo']) && $_GET['memo'] != MOrder::NO_CHOICE ? $_GET['memo'] : ''; $order->detail = $order->getDetailStr(); if ($_GET['selectNum'] != MOrder::NO_CHOICE) { $order->select_mobnum = $_GET['selectNum']; $mobnum = MMobnum::findOne($_GET['selectNum']); if ($mobnum === null || $mobnum->status != MMobnum::STATUS_UNUSED) { return json_encode(['status' => 1, 'errmsg' => $mobnum === null ? "mobile doest not exist" : "mobile locked!"]); } } else { $order->select_mobnum = ''; } $wid = Yii::$app->request->get('wid', ''); if (!empty($wid)) { list($scene_id, $scene_src_id) = explode('_', $wid); $order->scene_id = $scene_id; $order->scene_src_id = $scene_src_id; if (empty($order->item)) { U::W("@@@@@@@@@@@@@@@@@@@NULL@@@@@@@@@@@@@@@@@@@@@@@@@@@"); } $order->scene_amt = $order->feesum * $order->item->scene_percent / 100; } if ($order->save(false)) { if (isset($mobnum)) { $mobnum->status = MMobnum::STATUS_LOCKED; $mobnum->locktime = time(); $mobnum->save(false); } // clear win flag $model = MDisk::findOne(['gh_id' => $gh_id, 'openid' => $openid]); if ($model !== null) { $model->cnt = 0; $model->win = 0; $model->win_time = 0; $model->save(false); } //send wx message and sm //kzeng openid for test, //oKgUduJJFo9ocN8qO9k2N5xrKoGE //洪爱武 (宽带板块负责人) //oKgUduCGD_sGNYK3W02W8xutXvmo //办理宽带业务只向kzeng 发订单模板消息 if ($order->cid == 80050 || $order->cid == 80051 || $order->cid == 80052 || $order->cid == 80053 || $order->cid == 80054) { $manager = MStaff::findOne(['openid' => 'oKgUduCGD_sGNYK3W02W8xutXvmo']); } else { $manager = MStaff::findOne(['office_id' => $order->office_id, 'is_manager' => 1]); } if ($manager !== null && !empty($manager->openid)) { //U::W('sendWxm'); $manager->sendWxm($order->getWxNoticeToManager()); //U::W('sendSm'); //$manager->sendSm($order->getSmNoticeToManager()); try { $arr = $order->sendTemplateNoticeToManager($manager); } catch (\Exception $e) { U::W($e->getMessage()); } } else { U::W(['Have no manager or the manager has not binded openid', $order]); } /* // send wx message to user //$arr = Yii::$app->wx->WxMessageCustomSend(['touser'=>$openid, 'msgtype'=>'text', 'text'=>['content'=>$order->getWxNotice()]]); $arr = $order->sendTemplateNoticeToCustom(); */ } else { U::W([__METHOD__, $order->getErrors()]); } $jsApiParameters = $order->GetOrderJsApiParameters(); return json_encode(['oid' => $order->oid, 'status' => 0, 'pay_url' => $jsApiParameters]); }
public static function zujieAjax($goods_id, $user_id) { $goods = MGoods::findOne(['goods_id' => $goods_id]); $user = User::findOne(['id' => $user_id]); U::W($goods); $order = new MOrder(); if (empty($goods) || empty($user)) { U::W("----------goods or user is null--------"); return \yii\helpers\Json::encode(['code' => 1]); } $order->oid = uniqid(); $order->feesum = 0; $order->status = 1; $order->goods_id = $goods->goods_id; $order->title = $goods->title; $order->userid = $user->id; $order->username = $user->username; $order->usermobile = $user->mobile; $order->address = "--"; $order->memo = "--"; $order->memo_reply = "--"; $order->save(false); return \yii\helpers\Json::encode(['code' => 0]); }