123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\admin\logic\activity_area;
-
- use app\common\basics\Logic;
- use app\common\server\JsonServer;
- use think\facade\Db;
- use app\common\model\activity_area\ActivityArea;
- use app\common\model\activity_area\ActivityAreaGoods;
- use app\common\server\UrlServer;
-
-
- class AreaLogic extends Logic
- {
-
-
-
- public static function lists($get)
- {
-
- $where[] = ['del', '=', 0];
- $lists = ActivityArea::where($where)
- ->page($get['page'], $get['limit'])
- ->select();
-
- $count = ActivityArea::where($where)
- ->count();
-
- return ['count' => $count, 'lists' => $lists];
- }
-
-
-
- public static function add($post)
- {
-
- $post['create_time'] = time();
- if (isset($post['status']) && $post['status'] == 'on') {
- $post['status'] = 1;
- } else {
- $post['status'] = 0;
- }
- $post['image'] = UrlServer::setFileUrl($post['image']);
- return ActivityArea::insert($post);
- }
-
-
-
- public static function getActivityArea($id)
- {
-
- $data = ActivityArea::where(['id' => $id, 'del' => 0])->find();
- $data = $data->getData();
- $data['image'] = UrlServer::getFileUrl($data['image']);
- return $data;
- }
-
-
-
- public static function getActivityAreaAll()
- {
-
- return ActivityArea::where(['del' => 0])
- ->select();
- }
-
-
-
- public static function edit($post)
- {
-
- $post['image'] = UrlServer::setFileUrl($post['image']);
- return ActivityArea::update($post);
- }
-
-
-
- public static function del($id)
- {
-
- $AreaResult = ActivityArea::update(['del' => 1, 'id' => $id]);
- $AreaGoodsResult = ActivityAreaGoods::where('activity_area_id', $id)->update(['del' => 1]);
- return $AreaResult;
- }
- }
|