コード例 #1
0
 public function actionIndex()
 {
     U::W([__METHOD__, $_GET, $_POST]);
     //$this->layout = false;
     $this->layout = 'wapy';
     $alipay_config = Alipay::getAlipayConfig();
     $alipayNotify = new AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyReturn();
     if (!$verify_result) {
         Alipay::logResult(['Alipaycallback error', __METHOD__, $_GET, $_POST]);
         //return 'Alipaycallback error';
     }
     $result = $_GET['result'];
     if ($result != 'success') {
         Alipay::logResult(['Pay error', __METHOD__, $_GET, $_POST]);
         return 'Pay error';
     }
     $oid = $_GET['out_trade_no'];
     $model = MOrder::findOne($oid);
     if ($model === null) {
         U::W(['Invalid oid', $_GET, $_POST]);
         return "Invalid oid";
     }
     $model->pay_kind = MOrder::PAY_KIND_ALIWAP;
     $model->aliwap_trade_no = $_GET['trade_no'];
     $model->status = MOrder::STATUS_SUCCEEDED;
     if (!$model->save(false)) {
         U::W(['save db error', $_GET, $_POST, $model->getErrors()]);
         return 'system error';
     }
     //return 'Pay OK';
     return $this->render('index', ['gh_id' => $model->gh_id, 'openid' => $model->openid]);
 }
コード例 #2
0
ファイル: MMapApiQq.php プロジェクト: noikiy/wowewe
 public function submit($url, $params)
 {
     try {
         $requestUrl = $url . '?';
         if ($this->method == 'GET') {
             $requestUrl .= http_build_query($params);
             $postFields = null;
         } else {
             $postFields = $params;
         }
         $resp = U::curl($requestUrl, $postFields);
     } catch (Exception $e) {
         U::W($e->getCode() . ':' . $e->getMessage());
         return ['errcode' => $e->getCode(), 'errmsg' => $e->getMessage()];
     }
     if ("json" === $this->format) {
         $arr = json_decode($resp, true);
         if (null !== $arr) {
             return $arr;
         }
     } else {
         if ("xml" === $this->format) {
             $respObject = @simplexml_load_string($resp);
             if (false !== $respObject) {
                 return json_decode(json_encode($respObject), true);
             }
         }
     }
     return ['errcode' => 90000, 'errmsg' => 'HTTP_RESPONSE_NOT_WELL_FORMED'];
 }
コード例 #3
0
ファイル: MQingshiVote.php プロジェクト: noikiy/wowewe
 public static function toupiaoAjax($author_openid, $vote_openid)
 {
     $qingshi_vote = self::findOne(['vote_openid' => $vote_openid]);
     if (empty($qingshi_vote)) {
         $qingshi_vote = new \app\models\MQingshiVote();
     } else {
         //已经投过一次票了,提示用户已投过票,只能每人只能投一次票哟
         return \yii\helpers\Json::encode(['code' => 11]);
     }
     $qingshi_vote->author_openid = $author_openid;
     $qingshi_vote->vote_openid = $vote_openid;
     $qingshi_vote->save(false);
     //写入到投票表中;
     $qingshi_score = \app\models\MQingshiScore::findOne(['author_openid' => $author_openid]);
     U::W($qingshi_score);
     if (empty($qingshi_score)) {
         $qingshi_score = new \app\models\MQingshiScore();
     }
     $qa = \app\models\MQingshiAuthor::findOne(['author_openid' => $author_openid]);
     $qingshi_score->author_openid = $author_openid;
     $qingshi_score->score = $qingshi_score->score + 1;
     $qingshi_score->status = 0;
     $qingshi_score->create_time = $qa->create_time;
     $qingshi_score->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
コード例 #4
0
 public function actionIndex()
 {
     U::W([__METHOD__, $_GET, $_POST]);
     $notify = new PayNotifyCallBack();
     $respXml = $notify->Handle(false);
     return $respXml;
 }
コード例 #5
0
ファイル: MHd201509t6.php プロジェクト: noikiy/wowewe
 public static function hangbaoAjax($openid, $tcnx)
 {
     $hd201509t6 = self::findOne(['openid' => $openid]);
     if (empty($hd201509t6)) {
         U::W("----------hd201509t6 is null--------");
         return \yii\helpers\Json::encode(['code' => 1]);
     }
     //新用户 60:25:15 ---> 75:15:10
     $gailv1 = array(20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100);
     //76套餐以下 95:5:0
     $gailv2 = array(20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50);
     //76套餐以上 40:40:20
     $gailv3 = array(20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100);
     //echo $a[mt_rand(0,99)];
     if ($tcnx == 0) {
         $hbme = $gailv1[mt_rand(0, 99)];
     } else {
         if ($tcnx == 1) {
             $hbme = $gailv2[mt_rand(0, 99)];
         } else {
             $hbme = $gailv3[mt_rand(0, 99)];
         }
     }
     $hd201509t6->status = 0;
     $hd201509t6->hbme = $hbme;
     //$hd201509t6->create_time = date('y-m-d h:i:s',time());
     $hd201509t6->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
コード例 #6
0
 /**
  * Updates an existing MQingshiAuthor model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         //return $this->redirect(['view', 'id' => $model->id]);
         /*
         const AUDIT_NONE = 0;
         const AUDIT_FAIL = 1;
         const AUDIT_PASS = 2;
         */
         if ($model->status == 1) {
             $msg = ":-( 你的投稿没有审核通过。没关系啦,还可以为小伙伴们拉票哟~";
             if (!$model->user->sendWxm($msg)) {
                 U::W("wx send failed");
             }
         } else {
             if ($model->status == 2) {
                 $msg = "恭喜!您的投稿已通过审核,快号召小伙伴们来投票吧~";
                 if (!$model->user->sendWxm($msg)) {
                     U::W("wx send failed");
                 }
             }
         }
         //return $this->redirect(['memberlist']);
         return $this->redirect(['index', 'model' => $model]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }
コード例 #7
0
ファイル: NewfanReward.php プロジェクト: noikiy/wowewe
 public static function rewardconfirmAjax($newfan_openid)
 {
     U::W("=============ivegetit===============");
     U::W($newfan_openid);
     $newfan_reward = self::findOne(['newfan_openid' => $newfan_openid]);
     $newfan_reward->getting_time = time();
     $newfan_reward->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
コード例 #8
0
ファイル: ESms.php プロジェクト: noikiy/wowewe
 public function submit($url, $params)
 {
     try {
         $requestUrl = $url . '?';
         if ($this->method == 'GET') {
             $requestUrl .= http_build_query($params);
             $postFields = null;
         } else {
             $postFields = $params;
         }
         if ($this->debug) {
             U::W(array($requestUrl, $postFields));
             $this->resp_code = ESms::OK_CURL;
             return;
         }
         //U::W(array($requestUrl, $postFields));
         $resp = U::curl($requestUrl, $postFields);
         if ($this->message_is_gbk) {
             $resp = iconv("GBK", "UTF-8//IGNORE", $resp);
         }
         //U::W($resp);
     } catch (Exception $e) {
         U::W(array(__FUNCTION__, get_class($this), 'ERROR_CURL', $url, $params));
         $this->resp_code = ESms::ERROR_CURL;
         $this->resp = $e->getCode() . ',' . $e->getMessage();
         return;
     }
     $respWellFormed = false;
     if ("json" == $this->format) {
         $respObject = json_decode($resp);
         if (null !== $respObject) {
             $respWellFormed = true;
         }
     } else {
         if ("xml" == $this->format) {
             //$respObject = @simplexml_load_string($resp);
             $respObject = @simplexml_load_string(trim($resp));
             if (false !== $respObject) {
                 $respWellFormed = true;
                 $respObject = json_decode(json_encode($respObject));
             }
         } else {
             $respWellFormed = true;
             $respObject = $resp;
         }
     }
     if (false === $respWellFormed) {
         U::W(array(__FUNCTION__, get_class($this), 'HTTP_RESPONSE_NOT_WELL_FORMED', $resp, $url, $params));
         $this->resp_code = ESms::ERROR_HTTP_RESPONSE_NOT_WELL_FORMED;
         $this->resp = 'HTTP_RESPONSE_NOT_WELL_FORMED';
         return;
     }
     $this->resp_code = ESms::OK_CURL;
     $this->resp = $respObject;
     //U::W($this->resp);
 }
コード例 #9
0
ファイル: MDisk.php プロジェクト: noikiy/wowewe
 public static function diskwinnerAjax($openid)
 {
     U::W("-------------------------diskwinnerAjax-------------------------------");
     $disk = self::findOne(['openid' => $openid]);
     U::W($disk);
     $disk->win_time = time();
     $disk->win = 2;
     $disk->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
コード例 #10
0
ファイル: MHd201509t2.php プロジェクト: noikiy/wowewe
 public static function confirmAjax($openid)
 {
     $hd201509t2 = self::findOne(['openid' => $openid]);
     if (empty($hd201509t2)) {
         U::W("----------hd201509t2 is null--------");
         return \yii\helpers\Json::encode(['code' => 1]);
     }
     $hd201509t2->status = 1;
     $hd201509t2->create_time = date('y-m-d h:i:s', time());
     $hd201509t2->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
コード例 #11
0
ファイル: MsgController.php プロジェクト: noikiy/wowewe
 public function actionValid($token)
 {
     if (0) {
         $_GET['signature'] = '228c2744ce651fb61cceb461c48fa03c608c1299';
         $_GET['echostr'] = '6372428126615300095';
         $_GET['timestamp'] = '1402529705';
         $_GET['nonce'] = '1023195716';
     }
     if (!Wechat::checkSignature($token)) {
         U::W(['Invalid Signature in actionValid()', $_GET]);
     }
     die($_GET['echostr']);
 }
コード例 #12
0
 public function actionIndex()
 {
     U::W([__METHOD__, $_GET, $_POST]);
     $this->layout = false;
     $alipay_config = Alipay::getAlipayConfig();
     $alipayNotify = new AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyNotify();
     if (!$verify_result) {
         Alipay::logResult(['Alipaynotify sign error', __METHOD__, $_GET, $_POST]);
         return "fail";
     }
     if ($alipay_config['sign_type'] == 'MD5') {
         $respObject = @simplexml_load_string($_POST['notify_data']);
     } else {
         if ($alipay_config['sign_type'] == '0001') {
             $respObject = @simplexml_load_string($alipayNotify->decrypt($_POST['notify_data']));
         } else {
             Alipay::logResult(['Alipaynotify sign_type error', __METHOD__, $_GET, $_POST]);
         }
     }
     $arr = json_decode(json_encode($respObject), true);
     U::W($arr);
     $oid = $arr['out_trade_no'];
     $model = MOrder::findOne($oid);
     if ($model === null) {
         U::W(['Invalid oid', $_GET, $_POST, $arr]);
         return "success";
     }
     $model->pay_kind = MOrder::PAY_KIND_ALIWAP;
     $model->aliwap_trade_no = $arr['trade_no'];
     $model->aliwap_total_fee = $arr['total_fee'];
     $model->aliwap_trade_status = $arr['trade_status'];
     $model->aliwap_buyer_email = $arr['buyer_email'];
     $model->aliwap_quantity = $arr['quantity'];
     $model->aliwap_gmt_payment = $arr['gmt_payment'];
     if ($arr['trade_status'] == 'TRADE_FINISHED' || $arr['trade_status'] == 'TRADE_SUCCESS') {
         $model->status = MOrder::STATUS_SUCCEEDED;
     } else {
         U::W(['trade_status is not TRADE_FINISHED', $_GET, $_POST, $arr]);
     }
     if (!$model->save(false)) {
         U::W(['save db error', $_GET, $_POST, $arr, $model->getErrors()]);
     }
     return "success";
 }
コード例 #13
0
ファイル: HourController.php プロジェクト: noikiy/wowewe
 public function actionIndex()
 {
     set_time_limit(0);
     ini_set('memory_limit', '-1');
     if (!ini_set('memory_limit', '-1')) {
         U::W("ini_set(memory_limit) error");
     }
     $time = microtime(true);
     U::W("###########" . __CLASS__ . " BEGIN");
     self::refreshAccessToken();
     if (date('H') == 10 || date('H') == 11 || date('H') == 16 || date('H') == 17 || date('H') == 20) {
         if (date('H') == 11) {
             self::smsMarketing(1);
         } else {
             self::smsMarketing(1);
         }
     }
     U::W("###########" . __CLASS__ . " END, (time: " . sprintf('%.3f', microtime(true) - $time) . "s)");
 }
コード例 #14
0
ファイル: MyErrorAction.php プロジェクト: noikiy/wowewe
 public function run()
 {
     if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
         return '';
     }
     if ($exception instanceof HttpException) {
         $code = $exception->statusCode;
     } else {
         $code = $exception->getCode();
     }
     if ($exception instanceof Exception) {
         $name = $exception->getName();
     } else {
         $name = $this->defaultName ?: Yii::t('yii', 'Error');
     }
     if ($code) {
         $name .= " (#{$code})";
     }
     if ($exception instanceof WxException) {
         $resp = json_decode($exception->getMessage(), true);
         $message = $resp['errmsg'];
         $message .= ':' . $resp['errcode'];
     } else {
         if ($exception instanceof HttpException) {
             $message = $exception->getMessage();
         } else {
             if ($exception instanceof UserException) {
                 $message = $exception->getMessage();
             } else {
                 $message = $this->defaultMessage ?: Yii::t('yii', 'An internal server error occurred.');
             }
         }
     }
     if (Yii::$app->getRequest()->getIsAjax()) {
         U::W([$name, $message]);
         return "{$name}: {$message}";
     } else {
         U::W([$name, $message]);
         return $this->controller->render($this->view ?: $this->id, ['name' => $name, 'message' => $message, 'exception' => $exception, 'code' => $exception->getCode()]);
     }
 }
コード例 #15
0
ファイル: MChannel.php プロジェクト: noikiy/wowewe
 public function getQrImageUrl()
 {
     $gh_id = $this->gh_id;
     if (empty($this->scene_id)) {
         $newFlag = true;
         $gh = MGh::findOne($gh_id);
         $scene_id = $gh->newSceneId();
         $this->scene_id = $scene_id;
         //U::W("scene_id=$scene_id");
     } else {
         $newFlag = false;
         $scene_id = $this->scene_id;
     }
     $log_file_path = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'qr' . DIRECTORY_SEPARATOR . "{$gh_id}_{$scene_id}.jpg";
     //U::W($log_file_path);
     if (!file_exists($log_file_path)) {
         Yii::$app->wx->setGhId($gh_id);
         $arr = Yii::$app->wx->WxgetQRCode($scene_id, true);
         if (empty($arr['ticket'])) {
             U::W([__METHOD__, $arr]);
         }
         $url = Yii::$app->wx->WxGetQRUrl($arr['ticket']);
         Wechat::downloadFile($url, $log_file_path);
     }
     if ($newFlag) {
         if ($this->save(false)) {
             $gh->save(false);
         }
     }
     if (Yii::$app->getRequest()->getIsConsoleRequest()) {
         $url = '';
     } else {
         $url = Yii::$app->getRequest()->baseUrl . "/../runtime/qr/{$gh_id}_{$scene_id}.jpg";
     }
     //U::W($url);
     return $url;
 }
コード例 #16
0
ファイル: U.php プロジェクト: noikiy/wowewe
 public static function getSessionParam($key)
 {
     if (isset($_GET[$key])) {
         return $_GET[$key];
     } else {
         if (isset(Yii::$app->session[$key])) {
             return Yii::$app->session[$key];
         } else {
             if (Yii::$app->params['isWin'] && $key == 'gh_id' && Yii::$app->wx->localTest) {
                 return \app\models\MGh::GH_XIANGYANGUNICOM;
                 //return \app\models\MGh::GH_WOSO;
             } else {
                 if (Yii::$app->params['isWin'] && $key == 'openid' && Yii::$app->wx->localTest) {
                     //return \app\models\MGh::GH_XIANGYANGUNICOM_OPENID_HBHE;
                     return \app\models\MGh::GH_XIANGYANGUNICOM_OPENID_KZENG;
                     //return \app\models\MGh::GH_WOSO_OPENID_HBHE;
                     //return \app\models\MGh::GH_WOSO_OPENID_KZENG;
                 } else {
                     U::W(["no session data for {$key}", $_SERVER, $_SESSION]);
                     throw new HttpException(500, "session does not exist, key={$key}", 9000);
                 }
             }
         }
     }
 }
コード例 #17
0
ファイル: MOfficeScoreEvent.php プロジェクト: noikiy/wowewe
 public static function confirmAjax($office_id, $cat)
 {
     $office = MOffice::findOne(['office_id' => $office_id]);
     if (empty($office)) {
         $score = 0;
     } else {
         $score = $office->score;
     }
     if ($cat == self::CAT_30YUAN_DAIJINJUAN) {
         $dh_score = self::CAT_30YUAN_DAIJINJUAN_SCORE;
     } else {
         if ($cat == self::CAT_100YUAN_DAIJINJUAN) {
             $dh_score = self::CAT_100YUAN_DAIJINJUAN_SCORE;
         } else {
             $dh_score = self::CAT_30YUAN_DAIJINJUAN_SCORE;
         }
     }
     if ($score < $dh_score) {
         U::W("----------score not enough--------");
         return \yii\helpers\Json::encode(['code' => 1]);
     } else {
         $office_score_event = new MOfficeScoreEvent();
         $office_score_event->gh_id = 'gh_03a74ac96138';
         $office_score_event->openid = '';
         $office_score_event->office_id = $office_id;
         $office_score_event->cat = $cat;
         $office_score_event->score = $dh_score;
         $office_score_event->memo = self::getCatNameOption($cat);
         $office_score_event->status = 0;
         $office_score_event->code = '';
         $office_score_event->create_time = date('y-m-d h:i:s', time());
         $office_score_event->save(false);
         $office = MOffice::findOne(['office_id' => $office_id]);
         $office->score = $office->score - $dh_score;
         $office->save(false);
     }
     return \yii\helpers\Json::encode(['code' => 0]);
 }
コード例 #18
0
ファイル: WapController.php プロジェクト: noikiy/wowewe
 public function NotifyProcess($data, &$msg)
 {
     //Log::DEBUG("call back:" . json_encode($data));
     U::W([__METHOD__, $data, $msg]);
     /*
             $data => Array
             (
             [appid] => wx79c2bf0249ede62a
             [is_subscribe] => Y
             [mch_id] => 1220047701
             [nonce_str] => bfegWC2eAXolkxj8
             [openid] => oSHFKs9_gq4Ve6sHdQ86mJh1U3ZQ
             [product_id] => 123456789
             [sign] => 6D81DBD2229DC244D9E94E6BD24EF5B3
             )
     */
     if (!array_key_exists("openid", $data) || !array_key_exists("product_id", $data)) {
         $msg = "回调数据异常";
         return false;
     }
     $openid = $data["openid"];
     $product_id = $data["product_id"];
     $result = $this->unifiedorder($openid, $product_id);
     if (!array_key_exists("appid", $result) || !array_key_exists("mch_id", $result) || !array_key_exists("prepay_id", $result)) {
         $msg = "统一下单失败";
         return false;
     }
     $this->SetData("appid", $result["appid"]);
     $this->SetData("mch_id", $result["mch_id"]);
     $this->SetData("nonce_str", WxPayApi::getNonceStr());
     $this->SetData("prepay_id", $result["prepay_id"]);
     $this->SetData("result_code", "SUCCESS");
     $this->SetData("err_code_des", "OK");
     return true;
 }
コード例 #19
0
ファイル: MStaff.php プロジェクト: noikiy/wowewe
 public function sendSm($content)
 {
     try {
         if (empty($this->mobile) || !U::mobileIsValid($this->mobile)) {
             U::W(["manager's mobile is empty or invalid", $this->getAttributes(), __METHOD__]);
             return false;
         }
         U::W("balance before is " . \app\models\sm\ESmsGuodu::B());
         //$s = Yii::$app->sm->S($this->mobile, $content, '', 'guodu', true);
         $s = Yii::$app->sm->S($this->mobile, $content, '', null, true);
         //U::W($s->resp);
         $err_code = $s->getErrorMsg();
         $className = get_class($s);
         $err_code .= get_class($s);
         $smQueue = new MSmQueue();
         $smQueue->gh_id = $this->gh_id;
         $smQueue->receiver_mobile = $this->mobile;
         $smQueue->msg = $content;
         $smQueue->err_code = $err_code;
         if ($s->isSendOk()) {
             U::W('Send Sm OK');
             $smQueue->status = MSmQueue::STATUS_SENT;
         } else {
             U::W(['Send Sm ERR', $err_code, $s->resp]);
             $smQueue->status = MSmQueue::STATUS_ERR;
         }
         $smQueue->save(false);
         U::W("balance after is " . \app\models\sm\ESmsGuodu::B());
     } catch (\Exception $e) {
         U::W($e->getCode() . ':' . $e->getMessage());
     }
     return true;
 }
コード例 #20
0
ファイル: OrderController.php プロジェクト: noikiy/wowewe
 public function actionMemberupdate($id)
 {
     $model = MSceneDetail::findOne($id);
     if (!$model) {
         throw new NotFoundHttpException('no this gh');
     }
     if (\Yii::$app->request->isPost) {
         $model->load(\Yii::$app->request->post());
         if ($model->save()) {
             if ($model->status == MSceneDetail::STATUS_TIXIAN_OK) {
                 $msg = "充值成功";
             } else {
                 $msg = "充值失败";
             }
             if (!$model->user->sendWxm($msg)) {
                 U::W("wx send failed");
             }
             return $this->redirect(['memberlist']);
         } else {
             U::W($model->getErrors());
         }
     }
     return $this->render('memberupdate', ['model' => $model]);
 }
コード例 #21
0
ファイル: WapxController.php プロジェクト: noikiy/wowewe
 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]);
 }
コード例 #22
0
ファイル: prom.php プロジェクト: noikiy/wowewe
			alert('ok');
		} else {
			alert('启动微信支付失败, 请检查你的支付参数. 详细错误为: ' + res.err_msg);
		}

		});
	}
	</script>
	<button type="button" onclick="callpay()">wx pay test</button>


	<?php 
//test native url begin
$productId = '1234';
$url = Yii::$app->wx->create_native_url($productId);
\app\models\U::W("native url={$url}");
//$tag = Html::a('click here to native pay', $url);
$tag = "<a href=\"{$url}\">click here to native pay</a>";
echo $tag;
?>

<?php 
$this->endBody();
?>
</body>

</html>
<?php 
$this->endPage();
?>
コード例 #23
0
ファイル: SiteController.php プロジェクト: noikiy/wowewe
 public function actionProfile()
 {
     $user = MOffice::findOne(Yii::$app->user->id);
     //        if (is_numeric(Yii::$app->user->identity->openid))
     //            $office = MOffice::findOne(Yii::$app->user->identity->openid);
     if ($user->load(Yii::$app->request->post())) {
         if ($user->save(false, ['pswd'])) {
             Yii::$app->session->setFlash('success', '设置成功!');
             return $this->refresh();
         } else {
             U::W($user->getErrors());
         }
     }
     return $this->render('profile', ['model' => $user]);
 }
コード例 #24
0
ファイル: Wechat.php プロジェクト: noikiy/wowewe
 protected function check_cft_parameters()
 {
     if (!isset($this->_parameters["bank_type"]) || !isset($this->_parameters["body"]) || !isset($this->_parameters["partner"]) || !isset($this->_parameters["out_trade_no"]) || !isset($this->_parameters["total_fee"]) || !isset($this->_parameters["fee_type"]) || !isset($this->_parameters["notify_url"]) || !isset($this->_parameters["spbill_create_ip"]) || !isset($this->_parameters["input_charset"])) {
         U::W(['Invalid cft_parameters', __METHOD__, $this->_parameters]);
         return false;
     } else {
         return true;
     }
 }
コード例 #25
0
ファイル: NightController.php プロジェクト: noikiy/wowewe
 public static function checkSmBalance()
 {
     $balance = ESmsGuodu::B(false);
     if ($balance < 1000) {
         $model = MUser::findOne(['gh_id' => MGh::GH_XIANGYANGUNICOM, 'openid' => MGh::GH_XIANGYANGUNICOM_OPENID_KZENG]);
         try {
             $model->sendSmAlert($balance);
         } catch (\Exception $e) {
             U::W($e->getCode() . ':' . $e->getMessage());
         }
     }
 }
コード例 #26
0
ファイル: AdminController.php プロジェクト: noikiy/wowewe
 public function actionGhupdate($id)
 {
     $model = MGh::findOne($id);
     if (!$model) {
         throw new NotFoundHttpException('no this gh');
     }
     if (\Yii::$app->request->isPost) {
         $model->load(\Yii::$app->request->post());
         if ($model->save()) {
             return $this->redirect(['ghlist']);
         } else {
             U::W($model->getErrors());
         }
     }
     return $this->render('ghcreateupdate', ['model' => $model]);
 }
コード例 #27
0
ファイル: WechatWoso.php プロジェクト: noikiy/wowewe
 protected function onEventLocation()
 {
     //return Wechat::NO_RESP;
     $FromUserName = $this->getRequest('FromUserName');
     $gh_id = $this->getRequest('ToUserName');
     $model = MUser::findOne(['gh_id' => $gh_id, 'openid' => $FromUserName]);
     if ($model !== null) {
         $model->lat = $this->getRequest('Latitude');
         $model->lon = $this->getRequest('Longitude');
         $model->prec = $this->getRequest('Precision');
         $model->save(false);
         U::W("{$model->lat}, {$model->lon}");
     }
     return Wechat::NO_RESP;
 }
コード例 #28
0
ファイル: llb.php プロジェクト: noikiy/wowewe
}
?>
    </div>

    <div data-role="content">
        <ul data-role="listview" data-inset="false" class="ui-nodisc-icon ui-alt-icon">
        <!-- 流量包 -->
        <?php 
if ($kind == MItem::ITEM_KIND_FLOW_CARD) {
    ?>

             <?php 
    foreach ($models as $model) {
        if ($model->cid == 702 || $model->cid == 703 || $model->cid == 704 || $model->cid == 902 || $model->cid == 903 || $model->cid == 904) {
            U::W("\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$");
            U::W($model->cid);
            ?>
		                <li><a data-ajax="false" href="<?php 
            echo Url::to(['wap/card', 'cid' => $model->cid], true);
            ?>
">
		                        <img style='padding-top:20px' src="<?php 
            echo $model->pic_url . '-120x120.jpg';
            ?>
">
		                        <h2><?php 
            echo $model->title;
            ?>
</h2>
		                        <p><?php 
            echo $model->title_hint;
コード例 #29
0
ファイル: CmdController.php プロジェクト: noikiy/wowewe
 public function actionShowMobileInfo($id = null)
 {
     $postFields = null;
     $appkey = '5d4a589b32d70ad6378c8c69cba63524';
     //$appkey = ' -H apikey:3d9a61582849efccd65f77f34db064a8';
     $mobilenumber = '15071087608';
     $requestUrl = 'http://apis.juhe.cn/mobile/get?phone=' . $mobilenumber . '&key=' . $appkey;
     //$requestUrl = 'http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api&outfmt=json&mobile='.$mobilenumber;
     try {
         //U::W($requestUrl);
         $resp = U::curl($requestUrl, $postFields);
         //U::W($resp);
     } catch (Exception $e) {
         U::W($e->getCode() . ':' . $e->getMessage());
         return ['errcode' => $e->getCode(), 'errmsg' => $e->getMessage()];
     }
     $arr = json_decode($resp, true);
     if (null !== $arr) {
         U::W("--------------actionShowMobileInfo----------------");
         U::W($arr);
         //return $arr;
     }
 }
コード例 #30
0
ファイル: OrderController.php プロジェクト: hehbhehb/hongsong
 /**
  * Updates an existing MOrder model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     U::W("+++++++++++++++++++++actionUpdate++++++++++++++++++++++++++++");
     if ($model->load(Yii::$app->request->post())) {
         U::W($model);
         $model->save(false);
         return $this->redirect(['view', 'id' => $model->order_id]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }