|
@@ -122,30 +122,34 @@ class AuthController extends Controller
|
|
<Content><![CDATA[%s]]></Content>
|
|
<Content><![CDATA[%s]]></Content>
|
|
</xml>";
|
|
</xml>";
|
|
$msgType = "text";
|
|
$msgType = "text";
|
|
-
|
|
|
|
- $user = $app->user->get($fromUsername);
|
|
|
|
- $check_user = AlbumUserModel::where([['store_id',$store_id],['wechat_union_id',$user['unionid']]])->first();
|
|
|
|
- if ($check_user) {
|
|
|
|
- $check_user->g_open_id = $user['id'];
|
|
|
|
- $res = $check_user->save();
|
|
|
|
- } else {
|
|
|
|
- $data['username'] = $user['nickname'];
|
|
|
|
- $data['wechat_union_id'] = $user['unionid'];
|
|
|
|
- $data['avatar'] = $user['headimgurl'];
|
|
|
|
- $data['g_open_id'] = $fromUsername;
|
|
|
|
- $data['store_id'] = $store_id;
|
|
|
|
- $data['is_dealer'] = 0;
|
|
|
|
- $data['role'] = 0;
|
|
|
|
- $data['model'] = 0;
|
|
|
|
- $data['up_agent_id'] = 0;
|
|
|
|
- $res = AlbumUserModel::create($data);
|
|
|
|
- }
|
|
|
|
- if ($res) {
|
|
|
|
- $contentStr = "绑定成功";
|
|
|
|
|
|
+ if ($key == '绑定') {
|
|
|
|
+ $user = $app->user->get($fromUsername);
|
|
|
|
+ $check_user = AlbumUserModel::where([['store_id',$store_id],['wechat_union_id',$user['unionid']]])->first();
|
|
|
|
+ if ($check_user) {
|
|
|
|
+ $check_user->g_open_id = $user['id'];
|
|
|
|
+ $res = $check_user->save();
|
|
|
|
+ } else {
|
|
|
|
+ $data['username'] = $user['nickname'];
|
|
|
|
+ $data['wechat_union_id'] = $user['unionid'];
|
|
|
|
+ $data['avatar'] = $user['headimgurl'];
|
|
|
|
+ $data['g_open_id'] = $fromUsername;
|
|
|
|
+ $data['store_id'] = $store_id;
|
|
|
|
+ $data['is_dealer'] = 0;
|
|
|
|
+ $data['role'] = 0;
|
|
|
|
+ $data['model'] = 0;
|
|
|
|
+ $data['up_agent_id'] = 0;
|
|
|
|
+ $res = AlbumUserModel::create($data);
|
|
|
|
+ }
|
|
|
|
+ if ($res) {
|
|
|
|
+ $contentStr = "绑定成功";
|
|
|
|
+ } else {
|
|
|
|
+ $contentStr = "绑定失败";
|
|
|
|
+ }
|
|
|
|
+ \Log::info($user);
|
|
} else {
|
|
} else {
|
|
- $contentStr = "绑定失败";
|
|
|
|
|
|
+ $contentStr = "回复 绑定 即可绑定用户";
|
|
}
|
|
}
|
|
- \Log::info($user);
|
|
|
|
|
|
+
|
|
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
|
|
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
|
|
echo $resultStr;
|
|
echo $resultStr;
|
|
exit;
|
|
exit;
|
|
@@ -155,7 +159,7 @@ class AuthController extends Controller
|
|
if ($MsgT == "event") {
|
|
if ($MsgT == "event") {
|
|
$Event = $postObj->Event;
|
|
$Event = $postObj->Event;
|
|
if ($Event == 'subscribe') {
|
|
if ($Event == 'subscribe') {
|
|
- $contentStr = "欢迎关注";
|
|
|
|
|
|
+ $contentStr = "欢迎关注,回复 绑定 即可绑定用户";
|
|
} else {
|
|
} else {
|
|
$contentStr = "希望您下次关注,但您收不到此条消息了";
|
|
$contentStr = "希望您下次关注,但您收不到此条消息了";
|
|
}
|
|
}
|