|
@@ -0,0 +1,51 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\mobile\logic;
|
|
|
+
|
|
|
+use app\model\AccountModel;
|
|
|
+use app\model\AccountTokenModel;
|
|
|
+use app\model\CommonModel;
|
|
|
+use app\model\ServiceModel;
|
|
|
+use app\model\VideoModel;
|
|
|
+use think\Exception;
|
|
|
+use think\facade\Config;
|
|
|
+use think\facade\Db;
|
|
|
+use think\response\Json;
|
|
|
+
|
|
|
+class ServiceLogic extends BaseLogic
|
|
|
+{
|
|
|
+ //列表
|
|
|
+ public static function list(array $data = []): Json
|
|
|
+ {
|
|
|
+ $db = ServiceModel::where([
|
|
|
+ 'is_del' => CommonModel::$del_normal,
|
|
|
+ 'company_id' => self::$company_id,
|
|
|
+ 'card_id' => self::$card_id,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $count = $db->count('id');
|
|
|
+
|
|
|
+ $list = $db
|
|
|
+ ->field('id,original_price,activity_price,title,activity_status')
|
|
|
+ ->page($data['page'], $data['size'])
|
|
|
+ ->order(['id' => 'desc'])
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ return json_show(CommonModel::$success, '获取服务列表成功', ['count' => $count, 'list' => $list]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //详情
|
|
|
+ public static function read(int $id = 0): Json
|
|
|
+ {
|
|
|
+ $info = ServiceModel::field('id,original_price,activity_price,title,content,starttime,endtime,expiretime,activity_status')
|
|
|
+ ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
|
|
|
+ ->findOrEmpty()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ return $info ? json_show(CommonModel::$success, '获取服务详情成功', $info) : json_show(CommonModel::$error_param, '服务为空');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|