|
|
@@ -19,7 +19,8 @@ class Pledge extends Api
|
|
|
{
|
|
|
|
|
|
protected string $lan = '';
|
|
|
- protected $pay = [1=>'token', 2=>'teac'];
|
|
|
+ protected $pay = [1=>'token', 2=>'teac'];
|
|
|
+ protected $order = [1=>'desc', 2=>'asc'];
|
|
|
|
|
|
public function _initialize()
|
|
|
{
|
|
|
@@ -32,12 +33,22 @@ class Pledge extends Api
|
|
|
{
|
|
|
$type_id = $this->request->param('type_id', 0, 'intval');
|
|
|
if(empty($type_id)) $this->error(__("参数有误,无可用产品"));
|
|
|
-
|
|
|
+ $title = $this->request->param('title/s', '');
|
|
|
+ $day_num = $this->request->param('day_num/d', 0);
|
|
|
+ $income_reta = $this->request->param('income_reta/d', 0);
|
|
|
+ $map = [];
|
|
|
+ $order = 'weigh desc,id desc';
|
|
|
+ if(!empty($title)) $map[] = ['title', 'LIKE', '%'.$title.'%'];
|
|
|
+ if ($day_num > 0) $order = 'day_num '.$this->order[$day_num];
|
|
|
+ if ($income_reta > 0) $order = 'income_reta '.$this->order[$income_reta];
|
|
|
+ if ($day_num > 0 && $income_reta > 0) $order = 'day_num '.$this->order[$day_num].',income_reta '.$this->order[$income_reta];
|
|
|
+
|
|
|
$list = $productPledges
|
|
|
->where('status', $productPledges::Normal)
|
|
|
->where('to_lang', $this->lan)->where('type_id', $type_id)
|
|
|
+ ->where($map)
|
|
|
->field('id,title,day_num,income_reta,product_id,type_id')
|
|
|
- ->order('weigh desc,id desc')
|
|
|
+ ->order($order)
|
|
|
->paginate($this->pageSize);
|
|
|
|
|
|
$list = $pledgeLogic::getByProductIdList($list, $this->lan);
|