12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- class Storewatermark extends BaseModel
- {
-
- public function getOneStorewatermarkByStoreId($store_id)
- {
- $prefix = 'storewatermark_info';
- $cache_info = rcache($store_id, $prefix);
- if (empty($cache_info)) {
- $wm_arr = Db::name('storewatermark')->where('store_id', $store_id)->find();
- $cache = array();
- $cache['wm_arr'] = serialize($wm_arr);
- wcache($store_id, $cache, $prefix, 60 * 24);
- } else {
- $wm_arr = unserialize($cache_info['wm_arr']);
- }
- return $wm_arr;
- }
-
- public function addStorewatermark($data)
- {
- return Db::name('storewatermark')->insertGetId($data);
- }
-
- public function editStorewatermark($wm_id, $data)
- {
- $storewatermark_info = Db::name('storewatermark')->where('swm_id', $wm_id)->find();
- if ($storewatermark_info) {
-
- dcache($storewatermark_info['store_id'], 'storewatermark_info');
- }
- return Db::name('storewatermark')->where('swm_id', $wm_id)->update($data);
- }
-
- public function delStorewatermark($condition)
- {
- return Db::name('storewatermark')->where($condition)->delete();
- }
- }
|