|
|
@@ -70,10 +70,8 @@ class WxOpenController extends PublicController
|
|
|
}
|
|
|
util::fail();
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 创建第一个商家
|
|
|
- */
|
|
|
+
|
|
|
+ //创建平台使用的公众号
|
|
|
public function actionCallbackCreateFirstMerchant()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
@@ -148,7 +146,7 @@ class WxOpenController extends PublicController
|
|
|
$appData['shopProvince'] = '福建';
|
|
|
$appData['shopCity'] = '厦门';
|
|
|
$appData['shopDist'] = '思明区';
|
|
|
- $appData['alipayAccount'] = 'shishaohua8879@sina.com';
|
|
|
+ $appData['alipayAccount'] = 'shish@zhhinc.com';
|
|
|
$appData['alipayAccountName'] = '石少华';
|
|
|
$appData['agentLevel'] = 1;//默认设置为代理商
|
|
|
$merchant = xhMerchantService::applyCreateMerchant($appData);
|
|
|
@@ -156,11 +154,17 @@ class WxOpenController extends PublicController
|
|
|
$merchantId = $merchant['id'];
|
|
|
xhWxOpenService::updateById($wxOpenId, ['merchantId' => $merchantId]);
|
|
|
|
|
|
- xhWxMenuService::applyInit($merchant);//初始化微信菜单
|
|
|
+ //商品、分类、首页幻灯片、门店图片
|
|
|
+ //创建门店
|
|
|
+ //创建管理员
|
|
|
+ //客户信息初始化
|
|
|
+ //初始化微信菜单
|
|
|
+ xhWxMenuService::applyInit($merchant);
|
|
|
|
|
|
echo 'ok';
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function actionCallback()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
@@ -250,55 +254,10 @@ class WxOpenController extends PublicController
|
|
|
$merchantId = $merchant['id'];
|
|
|
xhMerchantService::updateById($merchantId, $cData);
|
|
|
}
|
|
|
- echo $authorizeAppId . ' ';
|
|
|
- exit('ok');
|
|
|
- $price = $set['price'];
|
|
|
- $now = time();
|
|
|
- $apply = xhApplyOrderService::getByMerchantId($merchantId);
|
|
|
- if (empty($apply)) {
|
|
|
- return $this->renderPartial('hint', ['msg' => '没有申请记录']);
|
|
|
- }
|
|
|
- $orderId = $apply['id'];
|
|
|
- $price = $apply['actPrice'];
|
|
|
- $openMerchant = xhWxOpenService::getMerchant();
|
|
|
- $openMerchantAccount = $openMerchant['id'];
|
|
|
- $account = $merchant['id'];
|
|
|
- //将新生成的商家account加密传到后台绑定管理员,密钥有效期5分钟
|
|
|
- $newAccount = urlencode(stringUtil::authcode($account, 'ENCODE', 300));
|
|
|
- if ($apply['payStatus'] == 1) {
|
|
|
- if (empty($merchant['adminId'])) {
|
|
|
- $this->redirect(Yii::$app->params['adminUrl'] . '/admin/generate?account=' . $openMerchantAccount . '&newAccount=' . $newAccount);
|
|
|
- util::end();
|
|
|
- }
|
|
|
- return $this->renderPartial('hint', ['msg' => '恭喜!您已申请成功。']);
|
|
|
- }
|
|
|
- if ($price > 0) {
|
|
|
- $this->redirect(Yii::$app->params['openUrl'] . '/pay/apply?orderId=' . $apply['id']);
|
|
|
- util::end();
|
|
|
- } else {
|
|
|
- $inviteCode = $order['inviteCode'];
|
|
|
- $now = time();
|
|
|
- if (!empty($inviteCode)) {
|
|
|
- $invite = xhInviteService::getByCode($inviteCode);
|
|
|
- if (empty($invite)) {
|
|
|
- return $this->renderPartial('hint', ['msg' => '邀请码不存在']);
|
|
|
- }
|
|
|
- if ($invite['takeStatus'] == 1) {//邀请码未使用,并且没有过期
|
|
|
- return $this->renderPartial('hint', ['msg' => '邀请码已经使用,请联系客服']);
|
|
|
- }
|
|
|
- $inviteDeadline = $invite['deadline'];
|
|
|
- if ($now > $inviteDeadline) {
|
|
|
- return $this->renderPartial('hint', ['msg' => '邀请码已经过期,请联系客服']);
|
|
|
- }
|
|
|
- xhInviteService::updateByCode($inviteCode, ['takeStatus' => 1, 'inviteUseTo' => 0, 'targetId' => $orderId, 'invitedMerchantId' => $merchantId]);
|
|
|
- }
|
|
|
- $updateData = ['inviteCodeStatus' => 1, 'payStatus' => 1, 'payWay' => 0, 'invitedMerchantId' => $merchantId];
|
|
|
- xhApplyOrderService::updateById($orderId, $updateData);
|
|
|
- $this->redirect(Yii::$app->params['adminUrl'] . '/admin/generate?account=' . $openMerchantAccount . '&newAccount=' . $newAccount);
|
|
|
- util::end();
|
|
|
- }
|
|
|
+ echo $authorizeAppId . ' ok';
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function actionResult()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|