Selaa lähdekoodia

更新2.6.13文件

liaofei 6 vuotta sitten
vanhempi
commit
62cfe778f0
39 muutettua tiedostoa jossa 323 lisäystä ja 150 poistoa
  1. 2 0
      application/admin/controller/Index.php
  2. 3 5
      application/admin/controller/article/WechatNews.php
  3. 7 2
      application/admin/controller/setting/SystemConfig.php
  4. 9 7
      application/admin/controller/store/StoreInfoMana.php
  5. 2 1
      application/admin/model/store/StoreProduct.php
  6. 4 2
      application/admin/model/system/SystemAttachment.php
  7. 2 3
      application/admin/model/user/User.php
  8. 1 1
      application/admin/model/user/UserExtract.php
  9. 3 3
      application/admin/model/wechat/WechatUser.php
  10. 6 7
      application/admin/view/finance/finance/commission_list.php
  11. 14 2
      application/admin/view/wechat/reply/add_keyword.php
  12. 12 1
      application/admin/view/wechat/reply/index.php
  13. 2 9
      application/config.php
  14. 8 0
      application/core/behavior/OrderBehavior.php
  15. 1 4
      application/core/model/routine/RoutineCode.php
  16. 0 9
      application/core/model/system/SystemUserLevel.php
  17. 1 1
      application/core/model/user/UserSign.php
  18. 2 0
      application/core/util/ApiLogs.php
  19. 6 3
      application/core/util/GroupDataService.php
  20. 5 5
      application/core/util/WechatService.php
  21. 26 0
      application/ebapi/controller/MiniProgram.php
  22. 27 25
      application/ebapi/controller/UserApi.php
  23. 1 1
      application/ebapi/model/store/StorePink.php
  24. 7 6
      application/ebapi/model/user/User.php
  25. 3 19
      application/ebapi/model/user/UserExtract.php
  26. 22 0
      application/ebapi/model/user/UserRecharge.php
  27. 2 2
      application/wap/model/store/StoreBargainUser.php
  28. 9 5
      application/wap/model/store/StoreBargainUserHelp.php
  29. 2 1
      application/wap/model/store/StorePink.php
  30. 4 4
      application/wap/model/user/User.php
  31. 4 4
      application/wap/model/user/UserExtract.php
  32. 1 1
      application/wap/view/first/my/extract.html
  33. 3 3
      application/wap/view/first/my/order_pink.html
  34. 4 4
      extend/Api/Storage/COS/COS.php
  35. 111 0
      extend/Api/Storage/OSS/OSS.php
  36. 1 1
      extend/service/CacheService.php
  37. 2 2
      extend/service/UpgradeService.php
  38. 2 2
      extend/service/UploadService.php
  39. 2 5
      extend/service/UtilService.php

+ 2 - 0
application/admin/controller/Index.php

@@ -29,6 +29,8 @@ class Index extends AuthController
         $adminInfo = $this->adminInfo->toArray();
         $roles  = explode(',',$adminInfo['roles']);
         $site_logo = SystemConfig::getOneConfig('menu_name','site_logo')->toArray();
+//        dump(SystemMenus::menuList());
+//        exit();
         $this->assign([
             'menuList'=>SystemMenus::menuList(),
             'site_logo'=>json_decode($site_logo['value'],true),

+ 3 - 5
application/admin/controller/article/WechatNews.php

@@ -91,11 +91,9 @@ class WechatNews extends AuthController
      */
     public function upload_image(){
         $res = Upload::Image($_POST['file'],'wechat/image/'.date('Ymd'));
-        //产品图片上传记录
-        $fileInfo = $res->fileInfo->getinfo();
-        SystemAttachment::attachmentAdd($res->fileInfo->getSaveName(),$fileInfo['size'],$fileInfo['type'],$res->dir,'',5);
-        if(!$res->status) return Json::fail($res->error);
-        return Json::successful('上传成功!',['url'=>$res->filePath]);
+        if(!is_array($res)) return Json::fail($res);
+        SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],5,$res['image_type'],$res['time']);
+        return Json::successful('上传成功!',['url'=>$res['thumb_path']]);
     }
 
     /**

+ 7 - 2
application/admin/controller/setting/SystemConfig.php

@@ -1,5 +1,6 @@
 <?php
 namespace app\admin\controller\setting;
+use app\admin\model\system\SystemAttachment;
 use think\Url;
 use service\FormBuilder as Form;
 use think\Request;
@@ -293,11 +294,15 @@ class SystemConfig extends AuthController
    public function view_upload(){
        if($_POST['type'] == 3){
            $res = Upload::file($_POST['file'],'config/file');
+           if(!$res->status) return Json::fail($res->error);
+           return Json::successful('上传成功!',['url'=>$res->dir]);
        }else{
            $res = Upload::Image($_POST['file'],'config/image');
+           if(is_array($res)){
+               SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],0,$res['image_type'],$res['time']);
+               return Json::successful('上传成功!',['url'=>$res['dir']]);
+           }else return Json::fail($res);
        }
-       if(!$res->status) return Json::fail($res->error);
-       return Json::successful('上传成功!',['url'=>$res->dir]);
    }
    /**
     * 文件上传

+ 9 - 7
application/admin/controller/store/StoreInfoMana.php

@@ -4,6 +4,7 @@ namespace app\admin\controller\store;
 
 use app\admin\controller\AuthController;
 use app\admin\library\FormBuilder;
+use app\admin\model\system\SystemAttachment;
 use service\UtilService as Util;
 use service\JsonService as Json;
 use service\UploadService as Upload;
@@ -64,15 +65,16 @@ class StoreInfoMana extends AuthController
     }
 
     /**
-     * s上传图片
+     * TODO 上传图片
      * */
-    public function upload(){
-        $res = Upload::image('file','article');
-        $thumbPath = Upload::thumb($res->dir);
-        if($res->status == 200)
-            return Json::successful('图片上传成功!',['name'=>$res->fileInfo->getSaveName(),'url'=>Upload::pathToUrl($thumbPath)]);
+    public function upload()
+    {
+        $res = Upload::image('file','article/'.date('Ymd'));
+        SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],2,$res['image_type'],$res['time']);
+        if(is_array($res))
+            return Json::successful('图片上传成功!',['name'=>$res['name'],'url'=>Upload::pathToUrl($res['thumb_path'])]);
         else
-            return Json::fail($res->error);
+            return Json::fail($res);
     }
 
     /**

+ 2 - 1
application/admin/model/store/StoreProduct.php

@@ -371,7 +371,8 @@ class StoreProduct extends ModelBasic
     //获取利润
     public static function ProfityTop10($where){
         $classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
-        $model=StoreOrder::alias('a')->join('StoreOrderCartInfo c','a.id=c.oid')->join('__STORE_PRODUCT__ b','b.id=c.product_id');
+        $model=StoreOrder::alias('a')->join('StoreOrderCartInfo c','a.id=c.oid')->join('__STORE_PRODUCT__ b','b.id=c.product_id')
+            ->where('b.is_show',1)->where('b.is_del',0);
         $list=self::getModelTime($where,$model,'a.add_time')->group('c.product_id')->order('profity desc')->limit(10)
             ->field(['count(c.product_id) as p_count','b.store_name','sum(b.price) as sum_price','(b.price-b.cost) as profity'])
             ->select();

+ 4 - 2
application/admin/model/system/SystemAttachment.php

@@ -66,8 +66,10 @@ class SystemAttachment extends ModelBasic
        $list = count($list) ? $list->toArray() : [];
         $site_url = SystemConfig::getValue('site_url');
         foreach ($list as &$item){
-            $item['satt_dir'] = (strpos($item['satt_dir'],$site_url) !== false || strstr($item['satt_dir'],'http') !== false) ? $item['satt_dir']:$site_url.$item['satt_dir'];
-            $item['att_dir'] = (strpos($item['att_dir'],$site_url) !== false ||  strstr($item['att_dir'],'http') !== false) ? $item['satt_dir']:$site_url.$item['att_dir'];
+            if($site_url) {
+                $item['satt_dir'] = (strpos($item['satt_dir'], $site_url) !== false || strstr($item['satt_dir'], 'http') !== false) ? $item['satt_dir'] : $site_url . $item['satt_dir'];
+                $item['att_dir']  = (strpos($item['att_dir'], $site_url) !== false || strstr($item['att_dir'], 'http') !== false) ? $item['satt_dir'] : $site_url . $item['att_dir'];
+            }
         }
        $count = self::where(['pid'=>$where['pid'],'module_type'=>1])->count();
        return compact('list','count');

+ 2 - 3
application/admin/model/user/User.php

@@ -573,13 +573,12 @@ class User extends ModelBasic
                 $value['nickname'],
                 $value['sum_number'],
                 $value['now_money'],
-                $value['money'],
-                $value['ex_price'],
+                $value['brokerage_price'],
                 $value['extract_price'],
             ];
         }
         if($where['excel']){
-            \service\PHPExcelService::setExcelHeader(['昵称/姓名','总佣金金额','提现佣金','余额','剩余佣金','提现到账佣金'])
+            \service\PHPExcelService::setExcelHeader(['昵称/姓名','总佣金金额','账户余额','账户佣金','提现到账佣金'])
                 ->setExcelTile('拥金记录','拥金记录'.time(),' 生成时间:'.date('Y-m-d H:i:s',time()))
                 ->setExcelContent($export)
                 ->ExcelSave();

+ 1 - 1
application/admin/model/user/UserExtract.php

@@ -61,7 +61,7 @@ class UserExtract extends ModelBasic
         $status = -1;
         $User= User::find(['uid'=>$uid])->toArray();
         UserBill::income('提现失败',$uid,'now_money','extract',$extract_number,$id,bcadd($User['now_money'],$extract_number,2),$mark);
-        User::bcInc($uid,'now_money',$extract_number,'uid');
+        User::bcInc($uid,'brokerage_price',$extract_number,'uid');
         $extract_type='未知方式';
         switch ($data['extract_type']){
             case 'alipay':

+ 3 - 3
application/admin/model/wechat/WechatUser.php

@@ -531,7 +531,7 @@ use app\core\util\SystemConfigService;
         $model=self::setSpreadWhere($where);
         $status =SystemConfigService::get('store_brokerage_statu');
         if(isset($where['excel']) && $where['excel'] == 1){
-            $list = $model->field(['a.uid','u.phone','a.nickname','a.sex','a.country','a.province','a.city','a.now_money','a.subscribe'])->select()->toArray();
+            $list = $model->field(['a.uid','u.phone','a.nickname','a.sex','a.country','a.province','a.city','a.now_money','a.subscribe','u.brokerage_price'])->select()->toArray();
             $export = [];
             foreach ($list as $index=>$item){
                 $uids = self::getModelTime($where,User::where('spread_uid',$item['uid']))->column('uid');
@@ -552,7 +552,7 @@ use app\core\util\SystemConfigService;
                 $item['order_stair']        = self::getUserSpreadOrderCount($item['uid'],0,$where);//一级推荐人订单
                 $item['order_second']       = self::getUserSpreadOrderCount($item['uid'],1,$where);//二级推荐人订单
                 //可提现佣金
-                $item['new_money']          = User::getextractPrice($item['uid'],$where);
+                $item['new_money']          = $item['brokerage_price'];
                 //总共佣金
                 $item['brokerage_money']    = self::getModelTime($where,UserBill::where(['uid'=>$item['uid'],'category'=>'now_money','type'=>'brokerage','pm'=>1,'status'=>1]))->sum('number');
                 $item['spread_name']='暂无';
@@ -620,7 +620,7 @@ use app\core\util\SystemConfigService;
             //总共佣金
             $item['brokerage_money']    = self::getModelTime($where,UserBill::where(['uid'=>$item['uid'],'category'=>'now_money','type'=>'brokerage','pm'=>1,'status'=>1]))->sum('number');
             //可提现佣金
-            $item['new_money']          = User::getextractPrice($item['uid'],$where);
+            $item['new_money']          = $item['brokerage_price'];
             $item['stair']              = self::getUserSpreadUidCount($item['uid'],0,$where);//一级推荐人
             $item['second']             = self::getUserSpreadUidCount($item['uid'],1,$where);//二级推荐人
             $item['order_stair']        = self::getUserSpreadOrderCount($item['uid'],0,$where);//一级推荐人订单

+ 6 - 7
application/admin/view/finance/finance/commission_list.php

@@ -65,13 +65,12 @@
     layList.form.render();
     layList.tableList('List',"{:Url('get_commission_list')}",function () {
         return [
-            {field: 'nickname', title: '昵称/姓名',unresize:true},
-            {field: 'sum_number', title: '总佣金金额',sort:true,unresize:true},
-            {field: 'now_money', title: '账户余额',unresize:true},
-            {field: 'money', title: '剩余佣金',unresize:true},
-            {field: 'ex_price', title: '提现佣金',unresize:true},
-            {field: 'extract_price', title: '提现到账佣金',unresize:true},
-            {fixed: 'right', title: '操作',align:'center',unresize:true,toolbar:'#barDemo'},
+            {field: 'nickname', title: '昵称/姓名',unresize:true,width:"16%",align:'center'},
+            {field: 'sum_number', title: '总佣金金额',sort:true,unresize:true,align:'center'},
+            {field: 'now_money', title: '账户余额',unresize:true,align:'center'},
+            {field: 'brokerage_price', title: '账户佣金',unresize:true,align:'center'},
+            {field: 'extract_price', title: '提现到账佣金',unresize:true,align:'center'},
+            {fixed: 'right', title: '操作',align:'center',unresize:true,toolbar:'#barDemo',width:"10%"},
         ];
     });
     layList.search('search');

+ 14 - 2
application/admin/view/wechat/reply/add_keyword.php

@@ -8,6 +8,7 @@
 {/block}
 {block name="content"}
 <div id="app" class="row">
+    <div ref="transfer"></div>
     <div class="col-sm-12">
         <div class="wechat-reply-wrapper">
             <div class="ibox-title"><p>{{msg}}</p></div>
@@ -176,6 +177,17 @@
                 uploadLink: ''
             },
             methods: {
+                transfer:function (str){
+                    var s = "";
+                    if (str.length === 0) { return "";}
+                    s = str.replace(/&amp;/g, "&");
+                    s = s.replace(/&lt;/g, "<");
+                    s = s.replace(/&gt;/g, ">");
+                    s = s.replace(/&nbsp;/g, " ");
+                    s = s.replace(/&#39;/g, "\'");
+                    s = s.replace(/&quot;/g, "\"");
+                    return s;
+                },
                 submit: function(){
                     if(!this.check()) return false;
                     window.vm = this;
@@ -227,7 +239,7 @@
                     this.uploadLink = "{:Url('upload_img')}";
                     $('#file').attr('accept','image/*');
                     this.uploadColl = function(pic){
-                        vm.dataGroup.image.src = pic;
+                        vm.dataGroup.image.src = vm.transfer(pic);
                     };
                     $('#file').trigger('click');
                 },
@@ -260,7 +272,7 @@
                                 vm.upload();
                             },
                             error: function (data, status, e) {
-                                $eb.message('error','上传失败!');
+                                $eb.message('success','上传失败!');
                                 vm.upload();
                             }
                         });

+ 12 - 1
application/admin/view/wechat/reply/index.php

@@ -214,6 +214,17 @@
                 uploadLink: ''
             },
             methods: {
+                transfer:function (str){
+                    var s = "";
+                    if (str.length === 0) { return "";}
+                    s = str.replace(/&amp;/g, "&");
+                    s = s.replace(/&lt;/g, "<");
+                    s = s.replace(/&gt;/g, ">");
+                    s = s.replace(/&nbsp;/g, " ");
+                    s = s.replace(/&#39;/g, "\'");
+                    s = s.replace(/&quot;/g, "\"");
+                    return s;
+                },
                 submit: function(){
                     if(!this.check()) return false;
                     $eb.axios.post("{:Url('save',array('key'=>$key))}",{key:this.key,status:this.status,data:this.dataGroup[this.type],type:this.type}).then(function(res){
@@ -255,7 +266,7 @@
                     this.uploadLink = "{:Url('upload_img')}";
                     $('#file').attr('accept','image/*');
                     this.uploadColl = function(pic){
-                        vm.dataGroup.image.src = pic;
+                        vm.dataGroup.image.src = vm.transfer(pic);
                     };
                     $('#file').trigger('click');
                 },

+ 2 - 9
application/config.php

@@ -144,13 +144,6 @@ return [
 
     // 视图输出字符串内容替换
     'view_replace_str'       => [
-        '{__PUBLIC_PATH}' =>  PUBILC_PATH,                 //public 目录
-        '{__STATIC_PATH}' =>  PUBILC_PATH.'static/',       //全局静态目录
-        '{__PLUG_PATH}'   =>  PUBILC_PATH.'static/plug/',  //全局静态插件
-        '{__ADMIN_PATH}'  =>  PUBILC_PATH.'system/',       //后台目录
-        '{__FRAME_PATH}'  =>  PUBILC_PATH.'system/frame/', //后台框架
-        '{__MODULE_PATH}' =>  PUBILC_PATH.'system/module/',//后台模块
-        '{__WAP_PATH}'    =>  PUBILC_PATH.'wap/first/'     //wap静态文件目录 模版1
     ],
     // 默认跳转页面对应的模板文件
     'dispatch_success_tmpl'  => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
@@ -166,7 +159,7 @@ return [
     // 错误显示信息,非调试模式有效
     'error_message'          => '页面错误!请稍后再试~',
     // 显示错误信息
-    'show_error_msg'         => true,
+    'show_error_msg'         => false,
     // 异常处理handle类 留空使用 \think\exception\Handle
     'exception_handle'       => '',
 
@@ -203,7 +196,7 @@ return [
         // 缓存前缀
         'prefix' => '',
         // 缓存有效期 0表示永久缓存
-        'expire' => 0,
+        'expire' => 60,
     ],
 
     // +----------------------------------------------------------------------

+ 8 - 0
application/core/behavior/OrderBehavior.php

@@ -217,4 +217,12 @@ class OrderBehavior
     {
 
     }
+
+    /*
+     * 订单未支付默认取消
+     * */
+    public static function orderUnpaidCancel()
+    {
+        StoreOrder::orderUnpaidCancel();
+    }
 }

+ 1 - 4
application/core/model/routine/RoutineCode.php

@@ -18,10 +18,7 @@ class RoutineCode{
         $res = RoutineQrcode::routineQrCodeForever($thirdId,$thirdType,$page,$imgUrl);
         $resCode = MiniProgramService::qrcodeService()->appCodeUnlimit($res->id,$page,280);
         if($resCode){
-            $dataQrcode['status'] = 1;
-            $dataQrcode['url_time'] = time();
-            $res = RoutineQrcode::setRoutineQrcodeFind($res->id,$dataQrcode);
-            if($res) return $resCode;
+            if($res) return ['res'=>$resCode,'id'=>$res->id];
             else return false;
         }else return false;
     }

+ 0 - 9
application/core/model/system/SystemUserLevel.php

@@ -83,11 +83,6 @@ class SystemUserLevel extends ModelBasic
      * */
     public static function getLevelListAndGrade($leval_id,$isArray,$expire=1400)
     {
-        if($isArray && Cache::has('LevelListArrayTask')){
-            return Cache::get('LevelListArrayTask');
-        }else if(Cache::has('LevelListArray')){
-            return Cache::get('LevelListArray');
-        }
         $grade=0;
         $list=self::setWhere()->field(['name','discount','image','icon','explain','id','grade'])->order('grade asc')->select();
         $list=count($list) ? $list->toArray() : [];
@@ -99,10 +94,6 @@ class SystemUserLevel extends ModelBasic
             if($grade < $item['grade']) $item['is_clear']=true;
             else $item['is_clear']=false;
         }
-        if($isArray)
-            Cache::set('LevelListArrayTask',$list,$expire);
-        else
-            Cache::set('LevelListArray',$list,$expire);
         return $list;
     }
 

+ 1 - 1
application/core/model/user/UserSign.php

@@ -113,7 +113,7 @@ class UserSign extends ModelBasic
         $res3=$user->save();
         $res = $res1 && $res2 && $res3!==false;
         ModelBasic::checkTrans($res);
-        HookService::afterListen('user_level',$user,false,UserBehavior::class);
+        HookService::afterListen('user_level',$user,null,false,UserBehavior::class);
         if($res)
             return $sign_num;
         else

+ 2 - 0
application/core/util/ApiLogs.php

@@ -24,6 +24,8 @@ class ApiLogs
     const ACCESS_TOKEN_PREFIX='AccessToken:';
     //api info 缓存前缀
     const AB_API_INFO='eb_ApiInfo:';
+    //未支付订单取消
+    const ORDER_UNPAID_PAGE='order_unpaid_page';
 
     // +----------------------------------------------------------------------
     // | 缓存时间配置区域

+ 6 - 3
application/core/util/GroupDataService.php

@@ -14,6 +14,9 @@ use think\Cache;
 class GroupDataService
 {
     protected static $isCaChe=true;
+
+    protected static $expire=60;
+
     /**获取单个组数据
      * @param $config_name
      * @param int $limit
@@ -26,7 +29,7 @@ class GroupDataService
             return Cache::get($cacheName);
         }else {
             $data=SystemGroupData::getGroupData($config_name, $limit);
-            if(self::$isCaChe) Cache::set($cacheName,$data);
+            if(self::$isCaChe) Cache::set($cacheName,$data,self::$expire);
             return $data;
         }
     }
@@ -43,7 +46,7 @@ class GroupDataService
             return Cache::get($cacheName);
         }else{
             $data=SystemGroupData::getAllValue($config_name,$limit);
-            if(self::$isCaChe) Cache::set($cacheName,$data);
+            if(self::$isCaChe) Cache::set($cacheName,$data,self::$expire);
             return $data;
         }
     }
@@ -60,7 +63,7 @@ class GroupDataService
             return Cache::get($cacheName);
         }else {
             $data=SystemGroupData::getDateValue($id);
-            if(self::$isCaChe) Cache::set($cacheName,$data);
+            if(self::$isCaChe) Cache::set($cacheName,$data,self::$expire);
             return $data;
         }
     }

+ 5 - 5
application/core/util/WechatService.php

@@ -34,9 +34,9 @@ class WechatService
         $wechat = SystemConfigService::more(['wechat_appid','wechat_appsecret','wechat_token','wechat_encodingaeskey','wechat_encode']);
         $payment = SystemConfigService::more(['pay_weixin_mchid','pay_weixin_client_cert','pay_weixin_client_key','pay_weixin_key','pay_weixin_open']);
         $config = [
-            'app_id'=>isset($wechat['wechat_appid']) ? $wechat['wechat_appid']:'',
-            'secret'=>isset($wechat['wechat_appsecret']) ? $wechat['wechat_appsecret']:'',
-            'token'=>isset($wechat['wechat_token']) ? $wechat['wechat_token']:'',
+            'app_id'=>isset($wechat['wechat_appid']) ? trim($wechat['wechat_appid']) :'',
+            'secret'=>isset($wechat['wechat_appsecret']) ? trim($wechat['wechat_appsecret']) :'',
+            'token'=>isset($wechat['wechat_token']) ? trim($wechat['wechat_token']) :'',
             'guzzle' => [
                 'timeout' => 10.0, // 超时时间(秒)
             ],
@@ -45,8 +45,8 @@ class WechatService
             $config['aes_key'] =  $wechat['wechat_encodingaeskey'];
         if(isset($payment['pay_weixin_open']) && $payment['pay_weixin_open'] == 1){
             $config['payment'] = [
-                'merchant_id'=>$payment['pay_weixin_mchid'],
-                'key'=>$payment['pay_weixin_key'],
+                'merchant_id'=>trim($payment['pay_weixin_mchid']),
+                'key'=>trim($payment['pay_weixin_key']),
                 'cert_path'=>realpath('.'.$payment['pay_weixin_client_cert']),
                 'key_path'=>realpath('.'.$payment['pay_weixin_client_key']),
                 //'notify_url'=>SystemConfigService::get('site_url').Url::build('wap/Wechat/notify')

+ 26 - 0
application/ebapi/controller/MiniProgram.php

@@ -0,0 +1,26 @@
+<?php
+namespace app\ebapi\controller;
+
+use app\core\util\MiniProgramService;
+
+
+/**
+ * TODO  小程序消息推送配置
+ * Class MiniProgram
+ * @package app\ebapi\controller
+ */
+class MiniProgram
+{
+
+    /**
+     * 微信服务器  验证
+     */
+    public function serve()
+    {
+        ob_clean();
+        MiniProgramService::serve();
+    }
+
+}
+
+

+ 27 - 25
application/ebapi/controller/UserApi.php

@@ -123,27 +123,14 @@ class UserApi extends AuthController
         $this->userInfo['recharge'] = UserBill::getRecharge($this->uid);//累计充值
         $this->userInfo['orderStatusSum'] = StoreOrder::getOrderStatusSum($this->uid);//累计消费
         $this->userInfo['extractTotalPrice'] = UserExtract::userExtractTotalPrice($this->uid);//累计提现
-        if($this->userInfo['brokerage'] > $this->userInfo['extractTotalPrice']) {
-            $orderYuePrice = StoreOrder::getOrderStatusYueSum($this->uid);//余额累计消费
-            $systemAdd = UserBill::getSystemAdd($this->uid);//后台添加余额
-            $yueCount = bcadd($this->userInfo['recharge'],$systemAdd,2);// 后台添加余额 + 累计充值  = 非佣金的总金额
-            $orderYuePrice = $yueCount > $orderYuePrice ? 0 : bcsub($orderYuePrice,$yueCount,2);// 余额累计消费(使用佣金消费的金额)
-            $this->userInfo['brokerage'] = bcsub($this->userInfo['brokerage'],$this->userInfo['extractTotalPrice'],2);//减去已提现金额
-            $extract_price = UserExtract::userExtractTotalPrice($this->uid,0);
-            $this->userInfo['brokerage'] = $extract_price < $this->userInfo['brokerage'] ? bcsub($this->userInfo['brokerage'],$extract_price,2) : 0;//减去审核中的提现金额
-            $this->userInfo['brokerage'] = $this->userInfo['brokerage'] > $orderYuePrice ? bcsub($this->userInfo['brokerage'],$orderYuePrice,2) : 0;//减掉余额支付
-        }else{
-            $this->userInfo['brokerage']=0;
-        }
-        $this->userInfo['extractPrice'] = (float)bcsub($this->userInfo['brokerage'],$this->userInfo['extractTotalPrice'],2) > 0 ?
-            bcsub($this->userInfo['brokerage'],$this->userInfo['extractTotalPrice'],2) : 0;//可提现
+        $this->userInfo['extractPrice'] = $this->userInfo['brokerage_price'];//可提现
         $this->userInfo['statu'] = (int)SystemConfigService::get('store_brokerage_statu');
-        $vipId=UserLevel::getUserLevel($this->uid);
+        $vipId = UserLevel::getUserLevel($this->uid);
         $this->userInfo['vip']=$vipId !==false ? true : false;
         if($this->userInfo['vip']){
-            $this->userInfo['vip_id']=$vipId;
-            $this->userInfo['vip_icon']=UserLevel::getUserLevelInfo($vipId,'icon');
-            $this->userInfo['vip_name']=UserLevel::getUserLevelInfo($vipId,'name');
+            $this->userInfo['vip_id'] = $vipId;
+            $this->userInfo['vip_icon'] = UserLevel::getUserLevelInfo($vipId,'icon');
+            $this->userInfo['vip_name'] = UserLevel::getUserLevelInfo($vipId,'name');
         }
         if(!SystemConfigService::get('vip_open')) $this->userInfo['vip']=false;
         unset($this->userInfo['pwd']);
@@ -301,17 +288,32 @@ class UserApi extends AuthController
      * @param int $price
      * @return \think\response\Json
      */
-    public function user_wechat_recharge($price = 0)
+    public function user_wechat_recharge($price = 0,$type = 0)
     {
         if(!$price || $price <=0) return JsonService::fail('参数错误');
         $storeMinRecharge = SystemConfigService::get('store_user_min_recharge');
         if($price < $storeMinRecharge) return JsonService::fail('充值金额不能低于'.$storeMinRecharge);
-        $rechargeOrder = UserRecharge::addRecharge($this->userInfo['uid'],$price,'routine');
-        if(!$rechargeOrder) return JsonService::fail('充值订单生成失败!');
-        try{
-            return JsonService::successful(UserRecharge::jsPay($rechargeOrder));
-        }catch (\Exception $e){
-            return JsonService::fail($e->getMessage());
+        switch ((int)$type){
+            case 0:
+                $rechargeOrder = UserRecharge::addRecharge($this->userInfo['uid'],$price,'routine');
+                if(!$rechargeOrder) return JsonService::fail('充值订单生成失败!');
+                try{
+                    return JsonService::successful(UserRecharge::jsPay($rechargeOrder));
+                }catch (\Exception $e){
+                    return JsonService::fail($e->getMessage());
+                }
+                break;
+            case 1:
+                if(UserRecharge::importNowMoney($this->uid,$price)){
+                    return JsonService::successful('转入成功');
+                }else{
+                    return JsonService::fail(UserRecharge::getErrorInfo('转入失败'));
+                }
+                break;
+            default:
+                return JsonService::fail('缺少转入类型');
+                break;
+
         }
     }
 

+ 1 - 1
application/ebapi/model/store/StorePink.php

@@ -361,7 +361,7 @@ class StorePink extends ModelBasic
             //处理拼团完成
             list($pinkAll,$pinkT,$count,$idAll,$uidAll)=self::getPinkMemberAndPinkK($pink);
             if($pinkT['status']==1){
-                if(!$count)//组团完成
+                if(!$count || $count < 0)//组团完成
                     self::PinkComplete($uidAll,$idAll,$pink['uid'],$pinkT);
                 else
                     self::PinkFail($pinkAll,$pinkT,0);

+ 7 - 6
application/ebapi/model/user/User.php

@@ -192,15 +192,16 @@ class User extends ModelBasic
         //TODO 获取上级推广员信息
         $spreadUserInfo = User::getUserInfo($userInfo['spread_uid']);
         //TODO 上级推广员返佣之后的金额
-        $balance = bcadd($spreadUserInfo['now_money'],$brokeragePrice,2);
+        $balance = bcadd($spreadUserInfo['brokerage_price'],$brokeragePrice,2);
         $mark = $userInfo['nickname'].'成功消费'.floatval($orderInfo['pay_price']).'元,奖励推广佣金'.floatval($brokeragePrice);
         self::beginTrans();
         //TODO 添加推广记录
         $res1 = UserBill::income('获得推广佣金',$userInfo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],$balance,$mark);
         //TODO 添加用户余额
-        $res2 = self::bcInc($userInfo['spread_uid'],'now_money',$brokeragePrice,'uid');
+        $res2 = self::bcInc($userInfo['spread_uid'],'brokerage_price',$brokeragePrice,'uid');
+        $res2 = true;
         $res = $res1 && $res2;
-        self::checkTrans($res);
+        self::checkTrans($res1);
         //TODO 一级返佣成功 跳转二级返佣
         if($res) return self::backOrderBrokerageTwo($orderInfo);
         return $res;
@@ -248,13 +249,13 @@ class User extends ModelBasic
         //TODO 获取上上级推广员信息
         $spreadUserInfoTwo = User::getUserInfo($userInfoTwo['spread_uid']);
         //TODO 获取上上级推广员返佣之后余额
-        $balance = bcadd($spreadUserInfoTwo['now_money'],$brokeragePrice,2);
+        $balance = bcadd($spreadUserInfoTwo['brokerage_price'],$brokeragePrice,2);
         $mark = '二级推广人'.$userInfo['nickname'].'成功消费'.floatval($orderInfo['pay_price']).'元,奖励推广佣金'.floatval($brokeragePrice);
         self::beginTrans();
         //TODO 添加返佣记录
         $res1 = UserBill::income('获得推广佣金',$userInfoTwo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],$balance,$mark);
-        //TODO 添加用户
-        $res2 = self::bcInc($userInfoTwo['spread_uid'],'now_money',$brokeragePrice,'uid');
+        //TODO 添加用户佣金金
+        $res2 = self::bcInc($userInfoTwo['spread_uid'],'brokerage_price',$brokeragePrice,'uid');
         $res = $res1 && $res2;
         self::checkTrans($res);
         return $res;

+ 3 - 19
application/ebapi/model/user/UserExtract.php

@@ -50,26 +50,10 @@ class UserExtract extends ModelBasic
         if(!in_array($data['extract_type'],self::$extractType))
             return self::setErrorInfo('提现方式不存在');
         $userInfo = User::get($userInfo['uid']);
-        $brokerage = UserBill::getBrokerage($userInfo['uid']);//获取总佣金
-        $recharge = UserBill::getRecharge($userInfo['uid']);//累计充值
-        $extractTotalPrice = UserExtract::userExtractTotalPrice($userInfo['uid']);//累计提现
-        if($brokerage > $extractTotalPrice) {
-            $orderYuePrice = StoreOrder::getOrderStatusYueSum($userInfo['uid']);//余额累计消费
-            $systemAdd = UserBill::getSystemAdd($userInfo['uid']);//后台添加余额
-            $yueCount = bcadd($recharge,$systemAdd,2);// 后台添加余额 + 累计充值  = 非佣金的总金额
-            $orderYuePrice = $yueCount > $orderYuePrice ? 0 : bcsub($orderYuePrice,$yueCount,2);// 余额累计消费(使用佣金消费的金额)
-            $brokerage = bcsub($brokerage,$extractTotalPrice,2);//减去已提现金额
-            $extract_price = self::userExtractTotalPrice($userInfo['uid'],0);
-            $brokerage = $extract_price < $brokerage ? bcsub($brokerage,$extract_price,2) : 0;//减去审核中的提现金额
-            $brokerage = $brokerage > $orderYuePrice ? bcsub($brokerage,$orderYuePrice,2) : 0;//减掉余额支付
-        }else{
-            $brokerage=0;
-        }
-        $extractPrice = (float)bcsub($brokerage,$extractTotalPrice,2) > 0 ?
-            bcsub($brokerage,$extractTotalPrice,2) : 0;//可提现
+        $extractPrice = $userInfo['brokerage_price'];
         if($extractPrice < 0) return self::setErrorInfo('提现佣金不足'.$data['money']);
         if($data['money'] > $extractPrice) return self::setErrorInfo('提现佣金不足'.$data['money']);
-        $balance = bcsub($userInfo['now_money'],$data['money'],2);
+        $balance = bcsub($userInfo['brokerage_price'],$data['money'],2);
         if($balance < 0) $balance=0;
         $insertData = [
             'uid'=>$userInfo['uid'],
@@ -100,7 +84,7 @@ class UserExtract extends ModelBasic
         try{
             $res1 = self::set($insertData);
             if(!$res1) return self::setErrorInfo('提现失败');
-            $res2 = User::edit(['now_money'=>$balance],$userInfo['uid'],'uid');
+            $res2 = User::edit(['brokerage_price'=>$balance],$userInfo['uid'],'uid');
             $res3 = UserBill::expend('余额提现',$userInfo['uid'],'now_money','extract',$data['money'],$res1['id'],$balance,$mark);
             $res = $res2 && $res3;
             if($res){

+ 22 - 0
application/ebapi/model/user/UserRecharge.php

@@ -62,4 +62,26 @@ class UserRecharge extends ModelBasic
         self::checkTrans($res);
         return $res;
     }
+
+    /*
+     * 导入佣金到余额
+     * @param int uid 用户uid
+     * @param string $price 导入金额
+     * */
+    public static function importNowMoney($uid,$price){
+        $user = User::getUserInfo($uid);
+        self::beginTrans();
+        try{
+            if($price > $user['brokerage_price']) return self::setErrorInfo('转入金额不能大于当前佣金!');
+            $res1 = User::bcInc($uid,'now_money',$price,'uid'); //增余额
+            $res3 = User::bcDec($uid,'brokerage_price',$price,'uid');//减佣金
+            $res2 = UserBill::expend('用户佣金转入余额',$uid,'now_money','recharge',$price,0,$user['now_money'],'成功转入余额'.floatval($price).'元');
+            $res = $res2 && $res1 && $res3;
+            self::checkTrans($res);
+            return $res;
+        }catch (\Exception $e){
+            self::rollbackTrans();
+            return self::setErrorInfo($e->getMessage());
+        }
+    }
 }

+ 2 - 2
application/wap/model/store/StoreBargainUser.php

@@ -1,14 +1,14 @@
 <?php
 namespace app\wap\model\store;
 
-use app\routine\model\user\User;
+use app\core\model\user\User;
 use basic\ModelBasic;
 use traits\ModelTrait;
 
 /**
  * 参与砍价Model
  * Class StoreBargainUser
- * @package app\routine\model\store
+ * @package app\wap\model\store
  */
 class StoreBargainUser extends ModelBasic
 {

+ 9 - 5
application/wap/model/store/StoreBargainUserHelp.php

@@ -1,13 +1,13 @@
 <?php
 namespace app\wap\model\store;
 
-use app\routine\model\user\User;
+use app\core\model\user\User;
 use basic\ModelBasic;
 use traits\ModelTrait;
 /**
  * 砍价帮砍Model
  * Class StoreBargainUser
- * @package app\routine\model\store
+ * @package app\wap\model\store
  */
 class StoreBargainUserHelp extends ModelBasic
 {
@@ -59,10 +59,10 @@ class StoreBargainUserHelp extends ModelBasic
         $data['uid'] = $uid;
         $data['bargain_id'] = $bargainId;
         $data['bargain_user_id'] = $bargainUserTableId;
-        $data['price'] = mt_rand($priceSection['bargain_min_price'],$priceSection['bargain_max_price']);
+        $data['price'] = (float)self::randomFloat($priceSection['bargain_min_price'],$priceSection['bargain_max_price']);
         $data['add_time'] = time();
         if($data['price'] > $surplusPrice) $data['price'] = $surplusPrice;
-        $price = bcadd($alreadyPrice,$data['price'],0);
+        $price = bcadd($alreadyPrice,$data['price'],2);
         $bargainUserData['price'] = $price;
         self::beginTrans();
         $res1 = StoreBargainUser::setBargainUserPrice($bargainUserTableId,$bargainUserData);
@@ -72,7 +72,11 @@ class StoreBargainUserHelp extends ModelBasic
         if($res) return $data;
         else return $res;
     }
-
+    //2位小数的随机数砍价用
+    public static function randomFloat($min = 0, $max = 10){
+        $num = $min + mt_rand() / mt_getrandmax() * ($max - $min);
+        return sprintf("%.2f", $num);
+    }
     /**
      * 判断用户是否还可以砍价
      * @param int $bargainId

+ 2 - 1
application/wap/model/store/StorePink.php

@@ -11,7 +11,7 @@ use app\wap\model\store\StoreCombination;
 use app\wap\model\user\User;
 use app\wap\model\user\WechatUser;
 use basic\ModelBasic;
-use service\WechatTemplateService;
+use app\core\util\WechatTemplateService;
 use think\Url;
 use traits\ModelTrait;
 
@@ -191,6 +191,7 @@ class StorePink extends ModelBasic
         return StoreOrder::where('id',$pink['order_id_key'])->value('order_id');
     }
 
+
     public static function systemPage($where){
         $model = new self;
         $model = $model->alias('p');

+ 4 - 4
application/wap/model/user/User.php

@@ -147,13 +147,13 @@ class User extends ModelBasic
         //TODO 获取上级推广员信息
         $spreadUserInfo = User::getUserInfo($userInfo['spread_uid']);
         //TODO 上级推广员返佣之后的金额
-        $balance = bcadd($spreadUserInfo['now_money'],$brokeragePrice,2);
+        $balance = bcadd($spreadUserInfo['brokerage_price'],$brokeragePrice,2);
         $mark = $userInfo['nickname'].'成功消费'.floatval($orderInfo['pay_price']).'元,奖励推广佣金'.floatval($brokeragePrice);
         self::beginTrans();
         //TODO 添加推广记录
         $res1 = UserBill::income('获得推广佣金',$userInfo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],$balance,$mark);
         //TODO 添加用户余额
-        $res2 = self::bcInc($userInfo['spread_uid'],'now_money',$brokeragePrice,'uid');
+        $res2 = self::bcInc($userInfo['spread_uid'],'brokerage_price',$brokeragePrice,'uid');
         $res = $res1 && $res2;
         self::checkTrans($res);
         //TODO 一级返佣成功 跳转二级返佣
@@ -199,13 +199,13 @@ class User extends ModelBasic
         //TODO 获取上上级推广员信息
         $spreadUserInfoTwo = User::getUserInfo($userInfoTwo['spread_uid']);
         //TODO 获取上上级推广员返佣之后余额
-        $balance = bcadd($spreadUserInfoTwo['now_money'],$brokeragePrice,2);
+        $balance = bcadd($spreadUserInfoTwo['brokerage_price'],$brokeragePrice,2);
         $mark = '二级推广人'.$userInfo['nickname'].'成功消费'.floatval($orderInfo['pay_price']).'元,奖励推广佣金'.floatval($brokeragePrice);
         self::beginTrans();
         //TODO 添加返佣记录
         $res1 = UserBill::income('获得推广佣金',$userInfoTwo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],$balance,$mark);
         //TODO 添加用户余额
-        $res2 = self::bcInc($userInfoTwo['spread_uid'],'now_money',$brokeragePrice,'uid');
+        $res2 = self::bcInc($userInfoTwo['spread_uid'],'brokerage_price',$brokeragePrice,'uid');
         $res = $res1 && $res2;
         self::checkTrans($res);
         return $res;

+ 4 - 4
application/wap/model/user/UserExtract.php

@@ -38,14 +38,14 @@ class UserExtract extends ModelBasic
     public static function userExtract($userInfo,$data){
         if(!in_array($data['extract_type'],self::$extractType))
             return self::setErrorInfo('提现方式不存在');
-        if($userInfo['now_money'] < $data['extract_price'])
-            return self::setErrorInfo('余额不足');
+        if($userInfo['brokerage_price'] < $data['extract_price'])
+            return self::setErrorInfo('佣金不足');
         if(!$data['real_name'])
             return self::setErrorInfo('输入姓名有误');
         $extractMinPrice = floatval(SystemConfigService::get('user_extract_min_price'))?:0;
         if($data['extract_price'] < $extractMinPrice)
             return self::setErrorInfo('提现金额不能小于'.$extractMinPrice);
-        $balance = bcsub($userInfo['now_money'],$data['extract_price']);
+        $balance = bcsub($userInfo['brokerage_price'],$data['extract_price']);
         $insertData = [
             'uid'=>$userInfo['uid'],
             'real_name'=>$data['real_name'],
@@ -69,7 +69,7 @@ class UserExtract extends ModelBasic
         self::beginTrans();
         $res1 = self::set($insertData);
         if(!$res1) return self::setErrorInfo('提现失败');
-        $res2 = User::edit(['now_money'=>$balance],$userInfo['uid'],'uid');
+        $res2 = User::edit(['brokerage_price'=>$balance],$userInfo['uid'],'uid');
         $res3 = UserBill::expend('余额提现',$userInfo['uid'],'now_money','extract',$data['extract_price'],$res1['id'],$balance,$mark);
         $res = $res2 && $res3;
         self::checkTrans($res);

+ 1 - 1
application/wap/view/first/my/extract.html

@@ -39,7 +39,7 @@
                     <input class="alipay-number" type="text" placeholder="支付宝账号" value="{$extractInfo.alipay_code}"/>
                 </div>
                 <input class="card-money" type="tel" placeholder="请输入提现金额"/>
-                <span class="balance">余额:¥<i>{$userInfo.now_money}</i></span>
+                <span class="balance">可提现佣金:¥<i>{$userInfo.brokerage_price}</i></span>
             </div>
         </div>
         <div class="error-txt" style="margin: 0;"></div>

+ 3 - 3
application/wap/view/first/my/order_pink.html

@@ -239,9 +239,9 @@
                     mounted: function () {
                         var wxApi = mapleWx($jssdk(), function () {
                             this.onMenuShareAll({
-                                title: $product.store_name,
-                                desc: $product.store_name,
-                                imgUrl: location.origin + $product.image,
+                                title: $product.title,
+                                desc: $product.info,
+                                imgUrl: $product.image,
                                 link: location.href
                             });
                         });

+ 4 - 4
extend/Api/Storage/COS/COS.php

@@ -90,7 +90,7 @@ class COS
                 'Body' => fopen($filePath, 'rb')
             ])];
         } catch (\Exception $e) {
-            return $e->getMessage();
+            return [false,$e->getMessage()];
         }
     }
 
@@ -103,13 +103,13 @@ class COS
     public static function uploadImageStream($key, $content){
         try {
             self::autoInfo();
-            return self::$auth->putObject([
+            return [self::$uploadUrl.$key,self::$auth->putObject([
                 'Bucket' => self::$storageName,
                 'Key' => $key,
                 'Body' => $content
-            ]);
+            ])];
         } catch (\Exception $e) {
-            return $e->getMessage();
+            return [false,$e->getMessage()];
         }
     }
 

+ 111 - 0
extend/Api/Storage/OSS/OSS.php

@@ -0,0 +1,111 @@
+<?php
+namespace Api\Storage\OSS;
+
+vendor('aliyun-oss-php-sdk.autoload');
+
+use app\core\util\SystemConfigService;
+use OSS\Core\OssException;
+use OSS\OssClient;
+use think\Request;
+use think\Cache;
+
+/**
+ * 阿里云OSS上传
+ * Class OSS
+ * @package Api\Storage\OSS
+ */
+class OSS
+{
+    protected static $accessKey;
+
+    protected static $secretKey;
+
+    protected static $auth = null;
+
+    //TODO 空间域名 Domain
+    protected static $uploadUrl;
+
+    //TODO 存储空间名称  公开空间
+    protected static $storageName;
+
+
+    /**
+     * TODO 初始化
+     * @return null|OssClient
+     * @throws \OSS\Core\OssException
+     */
+    protected static function autoInfo(){
+        if(($storageName = Cache::get('storageName')) && ($uploadUrl = Cache::get('uploadUrl')) && ($accessKey = Cache::get('accessKey')) && ($secretKey = Cache::get('secretKey'))){
+            self::$accessKey = $accessKey;
+            self::$secretKey = $secretKey;
+            self::$uploadUrl = $uploadUrl;
+            self::$storageName = $storageName;
+        }else{
+            self::$accessKey = trim(SystemConfigService::get('accessKey'));
+            self::$secretKey = trim(SystemConfigService::get('secretKey'));
+            self::$uploadUrl = trim(SystemConfigService::get('uploadUrl')).'/';
+            self::$storageName = trim(SystemConfigService::get('storage_name'));
+            Cache::set('accessKey',self::$accessKey);
+            Cache::set('secretKey',self::$secretKey);
+            Cache::set('uploadUrl',self::$uploadUrl);
+            Cache::set('storageName',self::$storageName);
+        }
+        if(!self::$accessKey || !self::$secretKey || !self::$uploadUrl || !self::$storageName){
+            exception('请设置 secretKey 和 accessKey 和 空间域名 和 存储空间名称');
+        }
+        if(self::$auth == null) {
+            self::$auth = new OssClient(self::$accessKey,self::$secretKey,self::$uploadUrl);
+            if(!self::$auth->doesBucketExist(self::$storageName)) self::$auth->createBucket(self::$storageName,self::$auth::OSS_ACL_TYPE_PUBLIC_READ_WRITE);
+        }
+        return self::$auth;
+    }
+
+    /**
+     * TODO 文件上传 名称
+     * @param string $filename
+     * @return string
+     */
+    public static function uploadImage($filename = 'image'){
+        $request = Request::instance();
+        $file = $request->file($filename);
+        $filePath = $file->getRealPath();
+        $ext = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
+        $key = substr(md5($file->getRealPath()) , 0, 5). date('YmdHis') . rand(0, 9999) . '.' . $ext;
+        try{
+            self::autoInfo();
+            return self::$auth->uploadFile(self::$storageName,$key,$filePath);
+        }catch (OssException $e){
+            return $e->getMessage();
+        }
+    }
+
+    /**
+     * TODO 文件上传 内容
+     * @param $key
+     * @param $content
+     * @return string
+     */
+    public static function uploadImageStream($key, $content){
+        try{
+            self::autoInfo();
+            return self::$auth->putObject(self::$storageName,$key,$content);
+        }catch (OssException $e){
+            return $e->getMessage();
+        }
+    }
+
+    /**
+     * TODO 删除资源
+     * @param $key
+     * @return mixed
+     */
+    public static function delete($key){
+        try {
+            self::autoInfo();
+            return self::$auth->deleteObject(self::$storageName,$key);
+        } catch (OssException $e) {
+            return $e->getMessage();
+        }
+    }
+
+}

+ 1 - 1
extend/service/CacheService.php

@@ -15,7 +15,7 @@ class CacheService
     protected static $globalCacheName = '_cached_1515146130';
 
 
-    public static function set($name, $value, $expire = 3600)
+    public static function set($name, $value, $expire = 60)
     {
         return self::handler()->set($name,$value,$expire);
     }

+ 2 - 2
extend/service/UpgradeService.php

@@ -58,12 +58,12 @@ class UpgradeService extends FileService
      * @param array $post_data
      */
     public static function start(){
-        $pach=APP_PATH.'version.php';
+        $pach=APP_PATH.'version';
         $request=Request::instance();
         if(!file_exists($pach)) return self::getRet($pach.'升级文件丢失,请联系管理员');
         $version=@file($pach);
         if(!isset($version[0])) return self::getRet('获取失败');
-        $lv=self::request_post(self::$isNowVersionUrl,['token'=>self::get_token()]);
+        $lv=self::request_post(self::$isNowVersionUrl,['token'=>self::get_token($request->ip())]);
         if(isset($lv['code']) && $lv['code']==200)
             $version_lv=isset($lv['data']['version']) && $lv['data']['version'] ? $lv['data']['version'] : false;
         else

+ 2 - 2
extend/service/UploadService.php

@@ -260,10 +260,10 @@ class UploadService
                 $info['image_type'] = 3;
                 break;
             case 4 :
-                $serverImageInfo = COS::uploadImageStream($key,$content);
+                list($imageUrl,$serverImageInfo) = COS::uploadImageStream($key,$content);
                 if(!is_array($serverImageInfo) && !is_object($serverImageInfo)) return $serverImageInfo;
                 if(is_object($serverImageInfo)) $serverImageInfo = $serverImageInfo->toArray();
-                $serverImageInfo['ObjectURL'] = UtilService::setHttpType($serverImageInfo['ObjectURL']);
+                $serverImageInfo['ObjectURL'] = $imageUrl;
                 $info['code'] = 200;
                 $info['name'] = substr(strrchr($serverImageInfo['ObjectURL'],'/'),1);
                 $info['dir'] = $serverImageInfo['ObjectURL'];

+ 2 - 5
extend/service/UtilService.php

@@ -523,11 +523,8 @@ class UtilService
     public static function setHttpType($url, $type = 0)
     {
         $domainTop = substr($url,0,5);
-        if($type){
-            if($domainTop == 'https') $url = 'http'.substr($url,5,strlen($url));
-        } else{
-            if($domainTop != 'https') $url = 'https:'.substr($url,5,strlen($url));
-        }
+        if($type){ if($domainTop == 'https') $url = 'http'.substr($url,5,strlen($url)); }
+        else{ if($domainTop != 'https') $url = 'https:'.substr($url,5,strlen($url)); }
         return $url;
     }