| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace app\admin\logic;
- use app\admin\model\dao\MoneyLog;
- use app\admin\model\dao\ScoreLog;
- use app\admin\model\dao\ShopOrder;
- use app\admin\model\dao\User;
- use app\common\model\BoxModel;
- use app\common\model\SystemBannerModel;
- use app\common\model\UserMoneyModel;
- use think\facade\Cache;
- use think\facade\Db;
- use utils\RedisCache;
- class SystemBannerLogic
- {
- public static function getList($page, $limit, $where, $sort)
- {
- $count = (new SystemBannerModel())
- ->where($where)
- ->count();
- $list = (new SystemBannerModel())
- ->where($where)
- ->withAttr('img_pic', function ($val, $data) {
- return __HTTPGETIMGADMIN($val);
- })
- ->page($page, $limit)
- ->order($sort)
- ->select();
- return [$count, $list];
- }
- public static function edit($post)
- {
- $row = new SystemBannerModel();
- try {
- $post['banner_desc'] = htmlspecialchars_decode($post['banner_desc']);
- $post['img_pic'] = __HTTPSAVEIMGADMIN($post['img_pic']);
- $save = $row->save($post);
- RedisCache::clear('getAppBanner' . $row['type']);
- return $save;
- } catch (\Exception $e) {
- return '保存失败';
- }
- }
- public static function add($data)
- {
- $data['img_pic'] = __HTTPSAVEIMGADMIN($data['img_pic']);
- $data['banner_desc'] = htmlspecialchars_decode($data['banner_desc']);
- $data['create_time'] = sr_getcurtime(time());
- unset($data['file']);
- $save = (new SystemBannerModel())->insert($data);
- RedisCache::clear('getAppBanner' . $data['type']);
- return $save;
- }
- }
|