lip 1 ヶ月 前
コミット
81cddcc6bd

+ 0 - 2
app/common/controller/Pub.php

@@ -11,8 +11,6 @@ use GatewayClient\Gateway;
 use app\manage\model\Config;
 use thans\jwt\facade\JWTAuth;
 
-use function AlibabaCloud\Client\json;
-
 /**
  * 控制器基础类
  */

+ 8 - 1
app/common/controller/User.php

@@ -60,6 +60,12 @@ class User
             $cs_uid = getAutoCsUid();   
             $userInfo=UserModel::where('user_id', $user_id)->withoutField('register_ip,login_count,update_time,create_time')->find();
             
+            
+            if (!$userInfo['cs_uid']) {
+                // 监听用户注册后的操作
+                event('UserRegister',['user_id' => $userInfo['user_id'], 'realname' => $userInfo['realname'], 'language_code' => $this->lang]);
+            }
+            
             //    如果用户已经有设置
             $setting=$userInfo['setting'] ?: '';
             if($setting){
@@ -77,11 +83,12 @@ class User
             
             $update=[
                 'last_login_time'=>time(),
+                'last_login_ip'=>$this->request->ip(),
                 'login_count'=>Db::raw('login_count+1'),
                 'avatar' => !empty($params['avatar']) ? $params['avatar'] : '',
                 'language' => $this->lang,
             ];
-            if ($userInfo['cs_uid'] == 1) {
+            if ($userInfo['cs_uid'] == 1 || $userInfo['cs_uid'] == 0) {
                 $update['cs_uid'] = $cs_uid;
             }
             if (!empty($params['realname'])) {

+ 4 - 4
app/enterprise/model/Message.php

@@ -118,10 +118,10 @@ class Message extends BaseModel
                 if(in_array($uid,$kefu) || in_array($param['toContactId'],$kefu)){
                     $manage=true;
                 }
-                if($chatSetting['simpleChat'] == 0 && !$manage){
-                    $this->error=lang('im.forbidChat');
-                    return false;
-                }
+                // if($chatSetting['simpleChat'] == 0 && !$manage){
+                //     $this->error=lang('im.forbidChat');
+                //     return false;
+                // }
                 // 如果是单聊,并且是社区模式和不是自己的客服、需要判断是否是好友
                 if ($globalConfig['sysInfo']['runMode'] == 2 && $csUid != $param['toContactId'] && !$manage) {
                     // 判断我是不是对方的客服