作者 jinglong
1 个管道 的构建 通过 耗费 7 秒

修改七牛云配置

... ... @@ -9,7 +9,7 @@ return array (
'content' =>
array (
),
'value' => 'm92odJHsEMRW6ZZzpwwCHRejn2kgK8Y4jEiMSlXk',
'value' => 'SH67W5to4mQn8ggENnnBJ0KaR_v4RADhIr27BweJ',
'rule' => 'required',
'msg' => '',
'tip' => '请在个人中心 > 密钥管理中获取 > AK',
... ... @@ -24,7 +24,7 @@ return array (
'content' =>
array (
),
'value' => 'YxYBAjxBLZTC1N9crjzwLkWTBxKi_MIv9pUHK0IS',
'value' => '25Umqk4bIBBBdbunXh4jW1Co5VJLH8qXe9X_ZpIE',
'rule' => 'required',
'msg' => '',
'tip' => '请在个人中心 > 密钥管理中获取 > SK',
... ... @@ -39,7 +39,7 @@ return array (
'content' =>
array (
),
'value' => 'jinglong',
'value' => 'feifangu',
'rule' => 'required',
'msg' => '',
'tip' => '存储空间名称',
... ... @@ -59,7 +59,7 @@ return array (
'https://upload-na0.qiniup.com' => '北美 https://upload-na0.qiniup.com',
'https://upload-as0.qiniup.com' => '东南亚 https://upload-as0.qiniup.com',
),
'value' => 'https://upload-z1.qiniup.com',
'value' => 'https://upload-z0.qiniup.com',
'rule' => 'required',
'msg' => '',
'tip' => '推荐选择最近的地址',
... ... @@ -74,7 +74,7 @@ return array (
'content' =>
array (
),
'value' => 'http://jinglong.springchunjia.cn',
'value' => 'http://feifangu.qiniu.brotop.cn',
'rule' => 'required',
'msg' => '',
'tip' => '未绑定CDN的话可使用七牛分配的测试域名',
... ...
... ... @@ -8,6 +8,7 @@ use app\common\controller\Api;
use fast\Http;
use think\Validate;
use think\Db;
use think\db\Expression;
/**
* 个人中心接口
... ... @@ -326,57 +327,15 @@ class User extends Api
$this->error($validate->getError());
}
$is_news = Common::is_new($this->uid);
$limit = config('verify.limit');
$where = ['uid'=>$this->uid];
if($is_news == 1){
//旧人
$where['is_new'] = 0;
}
$res = Db::name('collection')
->alias('c')
->join('goods g','c.g_id = g.id')
->where($where)
->field('g.id,g.image,g.name,g.tag,g.style,g.sale_price1 sale_price,g.expense_price,g.is_new')
->page($page,$limit)
->order('c.id desc')
->useSoftDelete('g.deletetime')
->select();
$collection = Common::selectWhereData('collection',['uid'=>$this->uid],'id,g_id');
$g_ids = array_column($collection,'g_id');
foreach ($res as &$value){
if($is_news == 2 || $is_news == 0){//未登录或者新人
if($value['is_new'] == 0){
//非新人优惠标签
$value['is_new_tag'] = 0;//不用显示新人价标签
}else{
//新人优惠标签
$value['is_new_tag'] = 1;//显示新人价标签
}
}else{
$value['is_new_tag'] = 0;//不用显示新人价标签(新人价标签商品不会出来)
}
$value['image'] = Common::absolutionUrlOne($value['image']);
$value['style'] = explode('|',$value['style']);
$value['tag'] = explode('|',$value['tag']);
$sale_price = Common::salePrice($value['sale_price']);
if($sale_price){
$value['sale_price'] = $sale_price[0];
}else{
$value['sale_price'] = '';
}
unset($value['is_new']);
}
$arr['data'] = $res;
//总页数
//按照指定的顺序排序
$g_id_str = implode(',',$g_ids);
$exp = new Expression('field(id,'.$g_id_str.')');
$count= Db::name('collection')
->alias('c')
->join('goods g','c.g_id = g.id')
->where($where)
->order('c.id desc')
->useSoftDelete('g.deletetime')
->count();
$arr['total_page'] = ceil($count/$limit);
$limit = config('verify.limit');
$arr = Common::goodsList(['id'=>['in',$g_ids]],$page,$this->uid,$limit,$exp);
$this->success('成功',$arr);
}else{
$this->error('请求方式错误');
... ...