xxxrrrdddd 3 年之前
父節點
當前提交
903f66b968
共有 2 個文件被更改,包括 18 次插入0 次删除
  1. 13 0
      application/api/controller/MobileController.php
  2. 5 0
      application/common/model/MobileOrder.php

+ 13 - 0
application/api/controller/MobileController.php

@@ -11,6 +11,7 @@ use app\common\model\MobileInfo;
 use app\common\model\MobileOrder;
 use app\common\model\MobileOrderNo;
 use app\common\model\Payment;
+use app\common\model\SysConfig;
 use app\common\service\Jdpay;
 use app\common\service\SmsSend;
 use think\App;
@@ -398,4 +399,16 @@ class MobileController extends UserApi
         $no->allowField(true)->save($data);
         $this->success('');
     }
+    /**
+     * 横幅播报
+     * @ApiReturnParams (name=ordered_num,description=已订购人数)
+     * @ApiReturnParams (name=ordered_num,description=已订购人数)
+     */
+    public function ordered_show(){
+        $data=[];
+        $data['ordered_num']=SysConfig::look('mo_ordered_num',0);
+        $data['ordered_list']=MobileOrder::payed()->order('id','desc')->limit(10)
+            ->select();
+        $this->success('',$data);
+    }
 }

+ 5 - 0
application/common/model/MobileOrder.php

@@ -8,6 +8,7 @@ use think\Model;
 
 /**
  * 配置模型
+ * @method static static payed()
  */
 class MobileOrder extends Model
 {
@@ -79,4 +80,8 @@ class MobileOrder extends Model
             throw_user('该产品无需支付');
         }
     }
+
+    public function scopePayed(Query $query){
+        $query->where('status','>=',self::STATUS_WAIT_SEND);
+    }
 }