浏览代码

轮播图调整

zhangxiaobin 1 年之前
父节点
当前提交
3da8bbd26e
共有 2 个文件被更改,包括 11 次插入6 次删除
  1. 1 1
      application/api/controller/Index.php
  2. 10 5
      application/common/library/Auth.php

+ 1 - 1
application/api/controller/Index.php

@@ -640,7 +640,7 @@ class Index extends Api
     public function bannerList()
     {
         try {
-            $field = 'id,title,image';
+            $field = 'id,title,image,url';
             $where['status'] = 1;
             $result = model('Banner')->field($field)->where($where)->order('weigh asc')->select();
             if (!$result) {

+ 10 - 5
application/common/library/Auth.php

@@ -669,7 +669,7 @@ class Auth
 
     public function openid_register($wechat_openid = '', $extend = [])
     {
-        /*if ($wechat_openid && User::getByOpenid($wechat_openid)) {
+        if ($wechat_openid && User::getByOpenid($wechat_openid)) {
             $this->setError('openid已存在');
             return false;
         }
@@ -712,17 +712,22 @@ class Auth
 
             //设置登录状态
             $this->_logined = true;
-
-            
-
+            //初始化权限
+            $userPowerWhere['user_id'] = $user->id;
+            $userPowerData = Db::name('user_power')->where($userPowerWhere)->find();
+            if (empty($userPowerData)) {
+                $powerData = ['user_id' => $user->id];
+                Db::name('user_power')->insertGetId($powerData);
+            }
             //注册成功的事件
             Hook::listen("user_register_successed", $this->_user, $data);
+            \app\common\model\NewBagHave::insert(["user_id" => $user->id, "createtime" => time()]);
             Db::commit();
         } catch (Exception $e) {
             $this->setError($e->getMessage());
             Db::rollback();
             return false;
-        }*/
+        }
         return true;
     }
 }