wupengfei 2 years ago
parent
commit
7f96a4a10e
2 changed files with 16 additions and 271 deletions
  1. 2 2
      .idea/workspace.xml
  2. 14 269
      application/api/controller/Qc.php

+ 2 - 2
.idea/workspace.xml

@@ -3,7 +3,7 @@
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Base.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Base.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Qc.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Qc.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -212,7 +212,7 @@
       <workItem from="1672880479757" duration="22897000" />
       <workItem from="1672966192005" duration="19617000" />
       <workItem from="1673052319155" duration="16867000" />
-      <workItem from="1673226266250" duration="14255000" />
+      <workItem from="1673226266250" duration="16175000" />
     </task>
     <servers />
   </component>

+ 14 - 269
application/api/controller/Qc.php

@@ -15,6 +15,20 @@ class Qc extends Base {
 
     public function index()
     {
+        var_dump(100053%10000,array_search('1',[1,2,3,4,7,1,1,5,6]));
+        die();
+        $goods_id = 1;
+        $total = Db::name('infinite_draw')->where(['goods_id'=>$goods_id])->count();
+        $limit = $total%10000;
+        if($limit > 10) {
+
+        }
+    }
+
+
+
+    public function index2()
+    {
         $this->error('6666',['second'=>11]);
         die();
 
@@ -34,277 +48,8 @@ class Qc extends Base {
         $result = array_values($result);
         $this->success('返回成功', $result);
     }
-    public function index22()
-    {
-        $app_name = sysconf('app_name');
-        $app_logo = sysconf('app_logo');
-        $search_log =  UserSearch::getSearchTitle($this->user_id,1);
-        $search_arr = [];
-        $where_str = 'b.id > 0';
-        foreach ($search_log as $t){
-            $search_arr[] =  " b.title like '".'%'.$t."%'" .' ';
-            $search_arr[] =  " b.label like '".'%'.$t."%'" .' ';
-        }
-        $table = 'dd_video_url';
-        if(!empty($search_arr)) $where_str  =  implode(' OR ',$search_arr);
-        $field = ' a.id,a.title,a.cover,a.user_id,a.is_vip,a.create_at,a.ali_vid,a.video_id,a.duration ,IFNULL(is_recommend,0) is_recommend ';
-        $list = VideoUrl::field($field)->alias('a')
-            ->leftJoin("(SELECT id,IF(id,1,1) is_recommend FROM $table b WHERE  ($where_str))  c","c.id = a.id ")
-            ->leftJoin('VideoIntro k','a.video_id  = k.id')
-            ->where('a.is_deleted = 0 AND a.status =1 AND k.is_deleted = 0 AND k.status = 1')
-            ->order('is_recommend DESC')
-            ->orderRaw("rand()")
-            ->limit($this->off_set,$this->page_num)
-            ->select()->toArray();
-        foreach ($list as $v)
-        {
-            var_dump($v['id'].'--'.$v['is_recommend']);
-        }
-        die();
-
-        $app_name = sysconf('app_name');
-        $app_logo = sysconf('app_logo');
-        $search_log =  UserSearch::getSearchTitle($this->user_id,1);
-        $search_arr = [];
-        $where_str = 'b.id > 0';
-        foreach ($search_log as $t){
-            $search_arr[] =  " b.title like '".'%'.$t."%'" .' ';
-            $search_arr[] =  " b.label like '".'%'.$t."%'" .' ';
-        }
-        if(!empty($search_arr)) $where_str  =  implode(' OR ',$search_arr);
-        $field = ' a.id,a.title,a.cover,a.user_id,a.is_vip,a.create_at,a.ali_vid,a.video_id,a.duration ,IFNULL(is_recommend,0) is_recommend ';
-        $table = 'dd_video_url';
-        $order_by_two = 'a.read_num';
-        $sql = "SELECT $field FROM " .$table . " a LEFT JOIN ( SELECT id,IF(id,1,1) is_recommend FROM $table b WHERE ( $where_str )) AS c ON c.id = a.id Left JOIN dd_video_intro as k ON a.video_id  = k.id  WHERE a.is_deleted = 0 AND a.status =1 AND k.is_deleted = 0 AND k.status = 1 ORDER BY is_recommend DESC , $order_by_two desc LIMIT {$this->off_set},{$this->page_num}";
-        $list = Db::query($sql);
-        array_walk($list,function (&$v,$k)use ($app_name,$app_logo){
-            if(!$v['user_id']){
-                $v['app_name']  = $app_name;
-                $v['app_logo']  = $app_logo;
-            }else{
-                $user_info = \app\common\model\User::where('id',$v['user_id'])->field('name,headimg')->find();
-                $v['app_name']  = $user_info ? $user_info->name : '';
-                $v['app_logo']  = $user_info ? $user_info->headimg : '';
-            }
-        });
-        $this->success('ok',['list'=>$list,'sql'=>$sql]);
-    }
-
-
-
-
-    public function payOrder()
-    {
-        $this->user_id = 22;
-        $order_id = input('post.order_id');
-        $pay_type = input('post.pay_type',1);
-        $order_info = LOM::where('id',$order_id)->find()->toArray();
-        if($order_info['status'] != 0) $this->error('订单状态错误');
-        if($order_info['cancel_state'] != 0 || $order_info['is_deleted'] != 0) $this->error('订单异常');
-        if($order_info['price_total'] <= 0) $this->error('订单金额错误');
-        $pay_no  = $order_info['pay_no'] ? $order_info['pay_no'] : get_order_sn();// 支付单号
-        if(!$order_info['pay_no']) LOM::where('id',$order_id)->update(['pay_no'=>$pay_no]);
-        $user_info = User::where('id',$this->user_id)->find()->toArray();
-        $ret_data = ['pay_status'=>0,'config'=>[],'code_url'=>'','openid'=>$user_info['openid']];
-        Db::startTrans();
-        try {
-            switch ($pay_type){
-                case 1://微信小程序
-                    $notify_url = $this->request->root(true) . '/api/we_chat_pay/LevelOrderNotify';
-                    $pay_config = WeChatPay::wxPay('订单支付',$pay_no,$order_info['price_total'],$notify_url,'MWEB');
-                    if($pay_config['code'] != 200) $this->exception($pay_config['msg']);
-                    $pay_config['config']['mch_id'] = config('app.wx_pay')['mch_id'];
-                    $pay_config['config']['pay_no'] = $pay_no;
-                    $pay_config['config']['notify_url'] = $notify_url;
-                    $pay_config['config']['mweb_url'] = $pay_config['mweb_url'];
-                    $pay_config['config']['total_fee'] = $order_info['price_total'] * 100;
-                    $ret_data['config'] = $pay_config['config'];
-                    break;
-                case 2 :
-                    if(!$user_info['openid']) $this->exception('请绑定公众号');
-                    $notify_url = $this->request->root(true) . '/api/we_chat_pay/LevelOrderNotify';
-                    $pay_config = WeChatPay::wxPay('订单支付',$pay_no,$order_info['price_total'],$notify_url,'JSAPI',$user_info['openid']);
-                    if($pay_config['code'] != 200) $this->exception($pay_config['msg']);
-                    $ret_data['config'] = $pay_config['config'];
-                    break;
-            }
-
-            Db::commit();
-        }catch (\Exception $e){
-            $this->is_commit = false;
-            $this->ret_msg =  $e->getMessage();
-            Db::rollback();
-        }
-        $this->transReturn($ret_data);
-    }
-
 
 
-    /**
-     * @title 获取分享的签名
-     * @desc 获取分享的签名
-     * @url /api/qc/getWeChatSign
-     * @method POST
-     * @tag 基础
-     *
-     **/
-    public function getWeChatSign(){
-        $urls = input('url');
-        $appid = config('app.official_account')['appid'];
-        $secret =  config('app.official_account')['secret'];
-        $redis = new Redis();
-        $access_token = $redis->get('access_token');
-        if (!$access_token){
-            $access_token = '';
-            $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$secret";
-            $res= http_curl($url);
-            if (isset($res['access_token'])){
-                $redis->set('access_token',$res['access_token'],'7000');
-                $access_token = $res['access_token'];
-            }
-        }
-
-        $url2 ="https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=".$access_token."&type=jsapi";
-        $res2=http_curl($url2);
-        if (!isset($res2) || $res2['errcode']!=0) $this->error('获取ticket失败');
-        $timestamp = time();
-        $noncestr = get32Str(15);
-        $string = "jsapi_ticket=".$res2['ticket']."&noncestr=$noncestr&timestamp=$timestamp&url=".$urls;
-        $sign = sha1($string);
-        $return = [
-            'appid'=>$appid,
-            'noncestr'=>$noncestr,
-            'timestamp'=>$timestamp,
-            'url'=>$urls,
-            'sign'=>$sign,
-            'ticket'=>$res2['ticket']
-        ];
-        $this->success('成功',$return);
-    }
-
-    /**
-     * 导入子项目数据
-     * @auth true
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function import()
-    {
-        $get = $this->request->get();
-        $import_path = $_SERVER['DOCUMENT_ROOT'].'/'.$get['path'];
-        $project_id = $get['project_id'];
-        $num = 5;
-        try {
-            $objReader =\PHPExcel_IOFactory::createReader('Excel2007');
-            $objExcel = $objReader->load($import_path);
-
-            $list = $objExcel->getActiveSheet()->toArray();
-            if (!isset($list[2][15]) || !$list[2][15]){
-                $this->error('失败');
-            }
-            if (isset($list[2][16])){
-                $this->error('失败');
-            }
-            Db::name($this->table3)->where('project_id',$project_id)->delete();
-            Db::name($this->table)->where('id',$project_id)->update(['url'=>$get['url']]);
-            $result = 0;
-            foreach ($list as $k=>$v){
-                if($k>=$num-1){
-                    if(array_filter($v)){
-                        $data=[];
-                        foreach ($v as $kk=>$vv){
-                            $data[IntToChr($kk)]=trim($vv);
-                        }
-                        $date['project_id'] = $project_id;
-                        $date['number'] = $data['A'];
-                        $date['cost_project'] = $data['B'];
-                        $date['area_calculating_aperture'] = $data['C'];
-                        $date['single_party_cost'] = $data['D'];
-                        $date['single_party_cost1'] = str_replace(',','',$data['D']);
-                        $date['total_price_included'] = $data['E'];
-                        $date['total_price_included1'] = str_replace(',','',$data['E']);
-                        $date['single_party_cost_excluding'] = $data['F'];
-                        $date['single_party_cost_excluding1'] = str_replace(',','',$data['F']);
-                        $date['total_price_included_excluding'] = $data['G'];
-                        $date['total_price_included_excluding1'] = str_replace(',','',$data['G']);
-
-                        $date['single_party_cost_tax'] = $data['H'];
-                        $date['single_party_cost_tax1'] = str_replace(',','',$data['H']);
-                        $date['single_party_cost_no_tax'] = $data['I'];
-                        $date['single_party_cost_no_tax1'] = str_replace(',','',$data['I']);
-
-                        $date['quantities'] = $data['J'];
-                        $date['quantities1'] = str_replace(',','',$data['J']);
-                        $date['calculating_unit'] = $data['K'];
-                        $date['unilateral_content'] = $data['L'];
-                        $date['unilateral_content1'] = str_replace(',','',$data['L']);
-                        $date['unilateral_content_excluding'] = $data['M'];
-                        $date['unilateral_content_excluding1'] = str_replace(',','',$data['M']);
-
-                        $date['saleable_single_party_tax'] = $data['N'];
-                        $date['saleable_single_party_tax1'] = str_replace(',','',$data['N']);
-
-                        $date['saleable_single_party_no_tax'] = $data['O'];
-                        $date['saleable_single_party_no_tax1'] = str_replace(',','',$data['O']);
-
-                        $date['note'] = $data['P'];
-                        $date['create_at'] = date('Y-m-d H:i:s');
-
-                        $numbers = explode('.',$data['A']);
-                        if (count($numbers)>1){
-                            array_pop($numbers); //去掉数组最后一组元素
-                            $number = implode('.',$numbers);
-                            $date['pid'] = Db::name($this->table3)->where('project_id',$project_id)->where('number',$number)->value('id');
-                            $date['pname'] = Db::name($this->table3)->where('project_id',$project_id)->where('number',$number)->value('cost_project');
-                        }else{
-                            $date['pid'] = 0;
-                            $date['pname'] = '';
-                        }
-                        if (Db::table($this->table3)->insertGetId($date)){
-                            $result = 1;
-                        }else{
-                            $result = 0;
-                            break;
-                        }
-                    }
-                }
-            }
-            if ($result==1){
-                $this->success('成功');
-            }else{
-                $this->error('失败');
-            }
-        } catch (\think\exception\ValidateException $e) {
-            $this->error($e->getMessage());
-
-        }
-    }
-
-    function excelToArray(){
-        //加载excel文件
-        $filename = dirname(__FILE__).'/result.xlsx';
-        $objPHPExcelReader = \PHPExcel_IOFactory::load($filename);
-
-        $sheet = $objPHPExcelReader->getSheet(0);        // 读取第一个工作表(编号从 0 开始)
-        $highestRow = $sheet->getHighestRow();           // 取得总行数
-        $highestColumn = $sheet->getHighestColumn();     // 取得总列数
-
-        $arr = array('A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
-        // 一次读取一列
-        $res_arr = array();
-        for ($row = 2; $row <= $highestRow; $row++) {
-            $row_arr = array();
-            for ($column = 0; $arr[$column] != 'F'; $column++) {
-                $val = $sheet->getCellByColumnAndRow($column, $row)->getValue();
-                $row_arr[] = $val;
-            }
-
-            $res_arr[] = $row_arr;
-        }
-
-        return $res_arr;
-    }
-