WxOpenController.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <?php
  2. namespace www\controllers;
  3. use common\services\xhMerchantExtendService;
  4. use Yii;
  5. use yii\web\Controller;
  6. use common\services\xhApplyOrderService;
  7. use common\services\xhWxMenuService;
  8. use common\services\xhMerchantService;
  9. use common\services\xhInviteService;
  10. use common\components\util;
  11. use common\components\configDict;
  12. use common\components\weixinOpenUtil;
  13. use common\services\xhWxOpenService;
  14. use common\components\stringUtil;
  15. use common\components\weixinUtil;
  16. use common\services\xhSetMealService;
  17. class WxOpenController extends PublicController
  18. {
  19. public $withoutLogin = ['callback-create-first-merchant'];
  20. public function actionGetAuthUrl()
  21. {
  22. $redirect = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=12548&pre_auth_code=55665&redirect_uri=6789";
  23. util::success(['url' => $redirect]);
  24. $open = xhWxOpenService::getById(1);
  25. $pre = weixinOpenUtil::getPreAuthCode($open);
  26. $appId = $open['appId'];
  27. $oData = [];
  28. $oData['preAuthCodeTime'] = date("Y-m-d H:i:s");//设置预授码过期,让下个用户可以获取新的预授码
  29. xhWxOpenService::updateById($id, $oData);
  30. $url = Yii::$app->params['w'] . '/join/callback';
  31. $merchantId = $open['merchantId'];//如果平台没有绑定商家,先去创建第一个商家
  32. if (empty($merchantId)) {
  33. $url = Yii::$app->params['w'] . '/join/callback-create-first-merchant';
  34. }
  35. $redirect = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={$appId}&pre_auth_code={$pre}&redirect_uri={$url}";
  36. util::success(['url' => $redirect]);
  37. }
  38. public function actionCheckMerchantName()
  39. {
  40. $get = Yii::$app->request->get();
  41. $merchantName = isset($get['merchantName']) ? $get['merchantName'] : '';
  42. $m = xhMerchantService::getByMerchantName($merchantName);
  43. if (!empty($m)) {
  44. util::failInfo('公众号名称已经使用');
  45. }
  46. util::successInfo();
  47. }
  48. /**
  49. * 下载微信里的图片到服务器
  50. */
  51. public function actionDownloadWxImg()
  52. {
  53. $get = Yii::$app->request->get();
  54. $mediaId = isset($get['mediaId']) ? $get['mediaId'] : '';
  55. $imgList = weixinUtil::downloadmediaIdImg($this->merchant, $mediaId);
  56. if (!empty($imgList)) {
  57. util::successInfo('操作成功', 'A0001', $imgList);
  58. }
  59. util::failInfo();
  60. }
  61. /**
  62. * 创建第一个商家
  63. */
  64. public function actionCallbackCreateFirstMerchant()
  65. {
  66. $get = Yii::$app->request->get();
  67. if (isset($get['auth_code']) == false) {
  68. return $this->renderPartial('hint', ['msg' => '公众号授权回调未成功']);
  69. }
  70. $code = $get['auth_code'];
  71. //使用授权码换取公众号的接口调用凭据和授权信息
  72. $authorizer = weixinOpenUtil::getAuthorizer($code);
  73. if (isset($authorizer['authorization_info']) == false) {
  74. return $this->renderPartial('hint', ['msg' => '未换取公众号的接口调用凭据和授权信息']);
  75. }
  76. $info = $authorizer['authorization_info'];
  77. $authorizer_appid = $info['authorizer_appid'];
  78. $authorizer_access_token = $info['authorizer_access_token'];
  79. $expires_in = $info['expires_in'];//7200
  80. $authorizer_refresh_token = $info['authorizer_refresh_token'];
  81. //获取授权方的公众号帐号基本信息
  82. $authorizerDetailInfo = weixinOpenUtil::getAuthorizerInfo($authorizer_appid);
  83. if (isset($authorizerDetailInfo['authorizer_info']) == false) {
  84. return $this->renderPartial('hint', ['msg' => '没有获取到公众号帐号基本信息']);
  85. }
  86. $authorizer_info = $authorizerDetailInfo['authorizer_info'];
  87. $nick_name = $authorizer_info['nick_name'];
  88. $head_img = $authorizer_info['head_img'];
  89. $service_type_info = $authorizer_info['service_type_info'];
  90. if ($service_type_info['id'] != 2) {
  91. return $this->renderPartial('hint', ['msg' => '公众号不是服务号']);
  92. }
  93. $verify_type_info = $authorizer_info['verify_type_info'];
  94. if ($verify_type_info['id'] != 0) {
  95. return $this->renderPartial('hint', ['msg' => '公众号还没有认证哦']);
  96. }
  97. $user_name = $authorizer_info['user_name'];
  98. $alias = $authorizer_info['alias'];
  99. $qrcode_url = $authorizer_info['qrcode_url'];
  100. $business_info = $authorizer_info['business_info'];
  101. $open_pay = $business_info['open_pay'];
  102. $merchant = xhMerchantService::getByAppId($authorizer_appid);
  103. $wxAccessTokenTime = date("Y-m-d H:i:s", (time() + $expires_in - 100));//安全起见,将过期时间设置得比微信里还短100秒
  104. if (!empty($merchant)) {
  105. return $this->renderPartial('hint', ['msg' => '平台已经关联公众号了']);
  106. }
  107. //引导生成商家
  108. $date = date("Y-m-d H:i:s");
  109. $trainDemo = configDict::getConfig('trainDemo');
  110. $logo = xhMerchantService::logoSave($head_img, $authorizer_appid);
  111. $appData['logo'] = $logo;
  112. $wxQrcodeUrl = xhMerchantService::qrCodeSave($qrcode_url, $authorizer_appid);
  113. $appData['wxQrcodeUrl'] = $wxQrcodeUrl;
  114. $appData['wxAppId'] = $authorizer_appid;
  115. $appData['wxUserName'] = $user_name;
  116. $appData['wxAliasName'] = $alias;
  117. $appData['wxAccessToken'] = $authorizer_access_token;
  118. $appData['wxAccessTokenTime'] = $wxAccessTokenTime;
  119. $appData['wxRefreshToken'] = $authorizer_refresh_token;
  120. $appData['accountStyle'] = 0;//认证服务号
  121. $appData['status'] = 0;//待审核
  122. $appData['createTime'] = $date;
  123. $appData['updateTime'] = $date;
  124. $appData['shopLat'] = (string)0;
  125. $appData['shopLong'] = (string)0;
  126. $appData['shopPrecision'] = (string)0;
  127. $appData['account'] = $trainDemo['platform']['account'];
  128. $appData['adminId'] = 0;
  129. $appData['wxToken'] = stringUtil::buildWxToken(0);
  130. $appData['shopPhotoList'] = '';
  131. $appData['merchantName'] = $nick_name;
  132. $appData['shopProvince'] = '福建';
  133. $appData['shopCity'] = '厦门';
  134. $appData['shopDist'] = '思明区';
  135. $appData['alipayAccount'] = 'shishaohua8879@sina.com';
  136. $appData['alipayAccountName'] = '石少华';
  137. $appData['agentLevel'] = 1;//默认设置为代理商
  138. $merchant = xhMerchantService::applyCreateMerchant($appData);
  139. $wxOpenId = configDict::getConfig('openId');
  140. $merchantId = $merchant['id'];
  141. $account = $merchant['id'];
  142. $createTime = date("Y-m-d H:i:s");
  143. $orderId = 'A' . stringUtil::buildOrderNo();
  144. $orderData = ['id' => $orderId, 'userId' => 0, 'applyName' => $nick_name, 'email' => '',
  145. 'createTime' => $createTime, 'accountId' => 0, 'inviteCode' => '', 'merchantId' => $merchantId, 'invitedMerchantId' => $merchantId,
  146. 'prePrice' => 0, 'actPrice' => 0, 'deadline' => time() + 2592000, 'inviteCodeStatus' => 0, 'payStatus' => 1,
  147. ];
  148. xhApplyOrderService::add($orderData);//保存订单信息
  149. xhWxOpenService::updateById($wxOpenId, ['merchantId' => $merchantId]);
  150. xhWxMenuService::applyInit($merchant);//初始化微信菜单
  151. $openMerchant = xhWxOpenService::getMerchant();
  152. $openMerchantAccount = $openmerchant['id'];
  153. //将新生成的商家account加密传到后台绑定管理员,密钥有效期5分钟
  154. $newAccount = urlencode(stringUtil::authcode($account, 'ENCODE', 300));
  155. $this->redirect(Yii::$app->params['adminUrl'] . '/admin/generate?account=' . $openMerchantAccount . '&newAccount=' . $newAccount);
  156. }
  157. public function actionCallback()
  158. {
  159. $get = Yii::$app->request->get();
  160. if (isset($get['auth_code']) == false) {
  161. return $this->renderPartial('hint', ['msg' => '公众号授权回调未成功']);
  162. }
  163. $code = $get['auth_code'];
  164. //使用授权码换取公众号的接口调用凭据和授权信息
  165. $authorizer = weixinOpenUtil::getAuthorizer($code);
  166. if (isset($authorizer['authorization_info']) == false) {
  167. return $this->renderPartial('hint', ['msg' => '未换取公众号的接口调用凭据和授权信息']);
  168. }
  169. $info = $authorizer['authorization_info'];
  170. $authorizer_appid = $info['authorizer_appid'];
  171. $authorizer_access_token = $info['authorizer_access_token'];
  172. $expires_in = $info['expires_in'];//7200
  173. $authorizer_refresh_token = $info['authorizer_refresh_token'];
  174. //获取授权方的基本信息
  175. $authorizerDetailInfo = weixinOpenUtil::getAuthorizerInfo($authorizer_appid);
  176. print_r($authorizerDetailInfo);
  177. if (isset($authorizerDetailInfo['authorizer_info']) == false) {
  178. return $this->renderPartial('hint', ['msg' => '没有获取到公众号帐号基本信息']);
  179. }
  180. $authorizer_info = $authorizerDetailInfo['authorizer_info'];
  181. $nick_name = $authorizer_info['nick_name'];
  182. $head_img = $authorizer_info['head_img'];
  183. $service_type_info = $authorizer_info['service_type_info'];
  184. if ($service_type_info['id'] != 2) {
  185. //return $this->renderPartial('hint',['msg' => '公众号不是服务号,appid:'.$authorizer_appid.' refresh:'.$authorizer_refresh_token]);
  186. }
  187. $verify_type_info = $authorizer_info['verify_type_info'];
  188. if ($verify_type_info['id'] != 0) {
  189. //return $this->renderPartial('hint',['msg' => '公众号还没有认证哦']);
  190. }
  191. $user_name = $authorizer_info['user_name'];
  192. $alias = $authorizer_info['alias'];
  193. $qrcode_url = $authorizer_info['qrcode_url'];
  194. $business_info = $authorizer_info['business_info'];
  195. $open_pay = $business_info['open_pay'];
  196. $accessTokenTime = date("Y-m-d H:i:s", (time() + $expires_in - 100));//安全起见,将过期时间设置得比微信里还短100秒
  197. //小程序
  198. if (isset($authorizer_info['MiniProgramInfo']) && !empty($authorizer_info['MiniProgramInfo'])) {
  199. $merchant = xhMerchantService::getByCondition(['miniAppId' => $authorizer_appid]);
  200. if (empty($merchant)) {
  201. Yii::info('没有小程序信息 appid:' . $authorizer_appid);
  202. echo '没有小程序信息 appid:' . $authorizer_appid;
  203. Yii::$app->end();
  204. }
  205. $merchantId = $merchant['id'];
  206. xhMerchantExtendService::updateByMerchantId($merchantId, ['miniAccessToken' => $authorizer_access_token, 'miniAccessTokenTime' => $accessTokenTime, 'miniRefreshToken' => $authorizer_refresh_token]);
  207. Yii::info('小程序信息更新成功:' . json_encode($authorizer_info));
  208. echo "<pre>";
  209. echo "小程序信息更新成功";
  210. } else {
  211. $merchant = xhMerchantService::getByAppId($authorizer_appid);
  212. Yii::info('appId:' . $authorizer_appid);
  213. $set = xhSetMealService::getRandOne();
  214. if (empty($set)) {
  215. return $this->renderPartial('hint', ['msg' => '没有套餐信息']);
  216. }
  217. if (empty($merchant)) {
  218. echo '这个商家没有生成过基本信息。appid:' . $authorizer_appid;
  219. Yii::$app->end();
  220. }
  221. if (empty($merchant)) {
  222. echo '新建商家能力暂时关闭';
  223. Yii::$app->end();
  224. //没有生成商家,引导进去设置
  225. $session = Yii::$app->session;
  226. $session['wxAppId'] = $authorizer_appid;
  227. $session['wxUserName'] = $user_name;
  228. $session['wxAliasName'] = $alias;
  229. $session['wxAccessToken'] = $authorizer_access_token;
  230. $session['wxAccessTokenTime'] = $accessTokenTime;
  231. $session['wxRefreshToken'] = $authorizer_refresh_token;
  232. $session['logo'] = $head_img;
  233. $session['wxQrcodeUrl'] = $qrcode_url;
  234. $session['allowGenerateMerchant'] = 'ok';//经过授权流程,允许允许生成商家
  235. $trainDemo = configDict::getConfig('trainDemo');
  236. $demoName = $trainDemo['merchant']['name'];//培训演示的公众号
  237. return $this->renderPartial('callback', ['merchantName' => $nick_name, 'set' => $set, 'demoName' => $demoName]);
  238. }
  239. $cData = [];
  240. $cData['wxAccessToken'] = $authorizer_access_token;
  241. $cData['wxAccessTokenTime'] = $accessTokenTime;
  242. $cData['wxRefreshToken'] = $authorizer_refresh_token;
  243. //审核通过
  244. $cData['status'] = 1;
  245. $merchantId = $merchant['id'];
  246. xhMerchantService::updateById($merchantId, $cData);
  247. }
  248. echo $authorizer_appid . ' ';
  249. exit('ok');
  250. $price = $set['price'];
  251. $now = time();
  252. $apply = xhApplyOrderService::getByMerchantId($merchantId);
  253. if (empty($apply)) {
  254. return $this->renderPartial('hint', ['msg' => '没有申请记录']);
  255. }
  256. $orderId = $apply['id'];
  257. $price = $apply['actPrice'];
  258. $openMerchant = xhWxOpenService::getMerchant();
  259. $openMerchantAccount = $openmerchant['id'];
  260. $account = $merchant['id'];
  261. //将新生成的商家account加密传到后台绑定管理员,密钥有效期5分钟
  262. $newAccount = urlencode(stringUtil::authcode($account, 'ENCODE', 300));
  263. if ($apply['payStatus'] == 1) {
  264. if (empty($merchant['adminId'])) {
  265. $this->redirect(Yii::$app->params['adminUrl'] . '/admin/generate?account=' . $openMerchantAccount . '&newAccount=' . $newAccount);
  266. util::end();
  267. }
  268. return $this->renderPartial('hint', ['msg' => '恭喜!您已申请成功。']);
  269. }
  270. if ($price > 0) {
  271. $this->redirect(Yii::$app->params['openUrl'] . '/pay/apply?orderId=' . $apply['id']);
  272. util::end();
  273. } else {
  274. $inviteCode = $order['inviteCode'];
  275. $now = time();
  276. if (!empty($inviteCode)) {
  277. $invite = xhInviteService::getByCode($inviteCode);
  278. if (empty($invite)) {
  279. return $this->renderPartial('hint', ['msg' => '邀请码不存在']);
  280. }
  281. if ($invite['takeStatus'] == 1) {//邀请码未使用,并且没有过期
  282. return $this->renderPartial('hint', ['msg' => '邀请码已经使用,请联系客服']);
  283. }
  284. $inviteDeadline = $invite['deadline'];
  285. if ($now > $inviteDeadline) {
  286. return $this->renderPartial('hint', ['msg' => '邀请码已经过期,请联系客服']);
  287. }
  288. xhInviteService::updateByCode($inviteCode, ['takeStatus' => 1, 'inviteUseTo' => 0, 'targetId' => $orderId, 'invitedMerchantId' => $merchantId]);
  289. }
  290. $updateData = ['inviteCodeStatus' => 1, 'payStatus' => 1, 'payWay' => 0, 'invitedMerchantId' => $merchantId];
  291. xhApplyOrderService::updateById($orderId, $updateData);
  292. $this->redirect(Yii::$app->params['adminUrl'] . '/admin/generate?account=' . $openMerchantAccount . '&newAccount=' . $newAccount);
  293. util::end();
  294. }
  295. }
  296. public function actionResult()
  297. {
  298. $get = Yii::$app->request->get();
  299. $id = isset($get['id']) ? $get['id'] : 0;
  300. $merchant = xhMerchantService::getById($id);
  301. $status = configDict::getConfig('merchantStatusName');
  302. $orMechantId = configDict::getConfig('merchantId');
  303. $originalMerchant = xhMerchantService::getById($orMechantId);
  304. return $this->renderPartial('result', ['originalMerchant' => $originalMerchant, 'merchant' => $merchant, 'status' => $status]);
  305. }
  306. /**
  307. * 商家申请入驻
  308. */
  309. public function actionAddMerchant()
  310. {
  311. $post = Yii::$app->request->post();
  312. $session = Yii::$app->session;
  313. if (isset($session['allowGenerateMerchant']) == false) {
  314. //util::failInfo('没有经过授权的操作');
  315. }
  316. unset($post['_csrf']);
  317. if (isset($session['wxAppId']) == false || empty($session['wxAppId'])) {
  318. util::failInfo('公众号appId不存在');
  319. }
  320. $wxAppId = $session['wxAppId'];
  321. if (isset($session['logo'])) {
  322. $logo = xhMerchantService::logoSave($session['logo'], $wxAppId);
  323. $post['logo'] = $logo;
  324. }
  325. if (isset($session['wxQrcodeUrl'])) {
  326. $wxQrcodeUrl = xhMerchantService::qrCodeSave($session['wxQrcodeUrl'], $wxAppId);
  327. $post['wxQrcodeUrl'] = $wxQrcodeUrl;
  328. }
  329. $date = date("Y-m-d H:i:s");
  330. $inviteCode = isset($post['inviteCode']) ? $post['inviteCode'] : '';
  331. $accountStyle = configDict::getConfig('accountStyle');
  332. $merchantStatus = configDict::getConfig('merchantStatus');
  333. $serviceAccount = $accountStyle['serviceAccount'];//认证服务号
  334. $checking = $merchantStatus['checking'];//审核中
  335. $merchantName = !empty($post['merchantName']) ? $post['merchantName'] : '';
  336. $exists = xhMerchantService::getByMerchantName($merchantName);
  337. if (!empty($exists)) {
  338. util::failInfo('花店名称已经存在了');
  339. }
  340. $post['wxAppId'] = $wxAppId;
  341. $post['wxUserName'] = $session['wxUserName'];
  342. $post['wxAliasName'] = $session['wxAliasName'];
  343. $post['wxAccessToken'] = $session['wxAccessToken'];
  344. $post['wxAccessTokenTime'] = $session['wxAccessTokenTime'];
  345. $post['wxRefreshToken'] = $session['wxRefreshToken'];
  346. $post['accountStyle'] = $serviceAccount;//认证服务号
  347. $post['status'] = $checking;//待审
  348. $post['createTime'] = $date;
  349. $post['updateTime'] = $date;
  350. $post['shopLat'] = isset($post['shopLat']) ? (string)$post['shopLat'] : (string)0;
  351. $post['shopLong'] = isset($post['shopLong']) ? (string)$post['shopLong'] : (string)0;
  352. $post['shopPrecision'] = isset($post['shopPrecision']) ? (string)$post['shopPrecision'] : (string)0;
  353. $account = stringUtil::buildOrderNo(0);
  354. $trainDemo = configDict::getConfig('trainDemo');
  355. $demoName = $trainDemo['merchant']['name'];//培训演示的公众号
  356. if (isset($post['merchantName']) && $post['merchantName'] == $demoName) {
  357. $account = $trainDemo['merchant']['account'];
  358. }
  359. $post['account'] = $account;
  360. $post['adminId'] = 0;
  361. $post['wxToken'] = stringUtil::buildWxToken(0);
  362. $shopPhotoListString = json_encode(["outdoor" => $post['shopImg'], 'indoor' => $post['shopImg2']]);//将门店照片组合成json
  363. $post['shopPhotoList'] = $shopPhotoListString;
  364. $merchant = xhMerchantService::applyCreateMerchant($post);
  365. $id = $merchant['id'];
  366. $account = $merchant['id'];
  367. unset($session['allowGenerateMerchant']);
  368. xhWxMenuService::applyInit($merchant);
  369. $set = xhSetMealService::getRandOne();
  370. $price = $set['price'];
  371. $actPrice = $price;
  372. $mainMerchantId = 0;
  373. $now = time();
  374. $orderDeadline = 0;
  375. if (!empty($inviteCode)) {
  376. $invite = xhInviteService::getByCode($inviteCode);
  377. if (empty($invite)) {
  378. util::failInfo('邀请码不存在');
  379. }
  380. if ($invite['takeStatus'] == 1) {//邀请码未使用,并且没有过期
  381. util::failInfo('邀请码已经使用');
  382. }
  383. $inviteDeadline = $invite['deadline'];
  384. if ($now > $inviteDeadline) {
  385. util::failInfo('邀请码已经过期');
  386. }
  387. $mainMerchantId = isset($invite['merchantId']) ? $invite['merchantId'] : 0;
  388. $actPrice = stringUtil::calcSub($set['price'], $invite['save']);//扣除邀请码里的钱
  389. }
  390. $toPay = $actPrice <= 0 ? 'no' : 'yes';//是否需要付款
  391. $inviteCodeStatus = $actPrice <= 0 ? 1 : 0;//邀请码是否已使用
  392. $payStatus = $actPrice <= 0 ? 1 : 0;//付款是否成功
  393. $createTime = date("Y-m-d H:i:s");
  394. $orderId = 'A' . stringUtil::buildOrderNo($id);
  395. $orderData = ['id' => $orderId, 'userId' => $this->userId, 'applyName' => $merchantName, 'email' => '',
  396. 'createTime' => $createTime, 'accountId' => 0, 'inviteCode' => $inviteCode, 'merchantId' => $mainMerchantId, 'invitedMerchantId' => $id,
  397. 'prePrice' => $price, 'actPrice' => $actPrice, 'deadline' => $orderDeadline, 'inviteCodeStatus' => (int)$inviteCodeStatus, 'payStatus' => $payStatus,
  398. ];
  399. xhApplyOrderService::add($orderData);//保存订单信息
  400. if ($actPrice <= 0 && !empty($inviteCode)) {
  401. xhInviteService::updateByCode($inviteCode, ['targetId' => $orderId, 'takeStatus' => 1, 'invitedMerchantId' => $id, 'inviteUseTo' => 0]);
  402. }
  403. $openMerchant = xhWxOpenService::getMerchant();
  404. $openMerchantAccount = $openmerchant['id'];
  405. $newAccount = urlencode(stringUtil::authcode($account, 'ENCODE', 300));
  406. util::successInfo('提交成功', 'A0001', ['account' => $openMerchantAccount, 'newAccount' => $newAccount, 'toPay' => $toPay, 'orderId' => $orderId, 'actPrice' => $actPrice]);
  407. }
  408. public function actionCheckInviteCode()
  409. {
  410. $get = Yii::$app->request->get();
  411. $code = isset($get['code']) ? $get['code'] : '';
  412. $invite = xhInviteService::getByCode($code);
  413. if (empty($invite)) {
  414. util::failInfo('邀请码错误');
  415. }
  416. $now = time();
  417. if ($now > $invite['deadline']) {
  418. util::failInfo('邀请码已经失效');
  419. }
  420. if (!empty($invite['takeStatus'])) {
  421. util::failInfo('邀请码已经使用');
  422. }
  423. util::successInfo('操作成功', 'A0001', $invite);
  424. }
  425. public function actionSelect()
  426. {
  427. $isWeixin = util::isWeixin();
  428. if ($isWeixin == false) {
  429. return $this->renderPartial('notWeixin');
  430. }
  431. return $this->renderPartial('select');
  432. }
  433. }