|
@@ -72,6 +72,7 @@ class AuthController extends Controller
|
|
|
|
|
|
public function notifyAccount(Request $request)
|
|
public function notifyAccount(Request $request)
|
|
{
|
|
{
|
|
|
|
+ $store_id = $request->input('store_id');
|
|
$config = [
|
|
$config = [
|
|
'app_id' => 'wxbce144ca3da7aa23',
|
|
'app_id' => 'wxbce144ca3da7aa23',
|
|
'secret' => '4d97eba675deeea187e1ebc32c1399da',
|
|
'secret' => '4d97eba675deeea187e1ebc32c1399da',
|
|
@@ -121,8 +122,29 @@ class AuthController extends Controller
|
|
<Content><![CDATA[%s]]></Content>
|
|
<Content><![CDATA[%s]]></Content>
|
|
</xml>";
|
|
</xml>";
|
|
$msgType = "text";
|
|
$msgType = "text";
|
|
- $contentStr = "openid是:" . $fromUsername;
|
|
|
|
|
|
+
|
|
$user = $app->user->get($fromUsername);
|
|
$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);
|
|
\Log::info($user);
|
|
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
|
|
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
|
|
echo $resultStr;
|
|
echo $resultStr;
|