Browse Source

Merge branch 'master' of http://git.huxiukeji.com/lizhen/xiaoshan

lizhen_gitee 2 months ago
parent
commit
578331c3f5

+ 16 - 2
application/api/controller/Baseconfig.php

@@ -3,6 +3,7 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
+use app\utils\Service\Tencent\TencentIm;
 use think\Db;
 /**
  * 基础配置接口
@@ -14,9 +15,22 @@ class Baseconfig extends Api
 
    
     public function index(){
-
+        $im   = new TencentIm();
+        $kefu = Db::name('admin')->field(['id', 'nickname', 'avatar', 'is_im'])->where('is_kefu', 1)->where('status', 'normal')->select();
+        foreach ($kefu as $key => $item) {
+            $chat_id               = im_prefix('_kefu_' . $item['id']);
+            $avatar                = !empty($item['avatar']) ? cdnurl($item['avatar']) : '';
+            $kefu[$key]['chat_id'] = $chat_id;
+            $kefu[$key]['avatar']  = $avatar;
+            // 注册IM
+            if ($item['is_im'] == 0) {
+                if ($im->register($chat_id, $item['nickname'], $avatar)) {
+                    Db::name('admin')->where('id', $item['id'])->update(['is_im' => 1]);
+                }
+            }
+        }
         $config = [
-            'kefu_user_ids'            => config('site.kefu_user_ids'),//在线客服人员
+            'kefu'    => $kefu,//在线客服人员
             'examine_bg_image' => cdnurl(config('site.examine_bg_image')),
 
         ];

+ 1 - 2
application/api/controller/Pay.php

@@ -185,8 +185,7 @@ class Pay extends Api
     //人民币充值
     public function money_config()
     {
-        $wallet         = (new Wallet())->getWallet($this->auth->id);
-        $data['wallet'] = $wallet;
+        $data['balance'] = (new Wallet())->getWallet($this->auth->id);
         $data['recharge_explain'] = config('site.recharge_explain');
         $list           = Db::name('paymoney_config')->order('weigh asc,id asc')->where('is_show', 1)->select();
         $data['config'] = $list;

+ 0 - 2
application/api/controller/Userwallet.php

@@ -20,8 +20,6 @@ class Userwallet extends Api
         $this->success('success',$wallet);
     }
 
-
-
     //我的余额日志
     public function my_money_log()
     {

+ 1 - 1
application/common/library/Auth.php

@@ -188,7 +188,7 @@ class Auth
             $this->_logined = true;
 
             //注册钱包
-            Db::name('user_wallet')->insertGetId(['user_id'=>$user->id]);
+//            Db::name('user_wallet')->insertGetId(['user_id'=>$user->id]);
 
             //注册成功的事件
             Hook::listen("user_register_successed", $this->_user, $data);

+ 6 - 1
application/common/model/Wallet.php

@@ -53,7 +53,7 @@ class Wallet extends Model
      * @param string $wallet_name 指定钱包名
      * @return array|float
      */
-    public function getWallet($user_id = 0, $wallet_name = '')
+    public function getWalletBak($user_id = 0, $wallet_name = '')
     {
         //所有钱包余额
         if (!$wallet = Db::name('user_wallet')->where(['user_id' => $user_id])->find()) {
@@ -67,6 +67,11 @@ class Wallet extends Model
         }
     }
 
+    public function getWallet($user_id = 0, $wallet_name = 'money')
+    {
+        return Db::name('user')->where('id',$user_id)->value($wallet_name);
+    }
+
 
     /**
      *