12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types = 1);
- namespace app\common\model;
- /**
- * 短信提醒模板
- * Class Delivery
- * @package app\common\model
- */
- class SmsRemind extends BaseModel
- {
-
- const FTYPE = [1=>'已下单待发货'];
- // 定义表名
- protected $name = 'sms_remind';
- protected $append = ['ftype_text','hours_text'];
- public function getFtypeTextAttr(){
- return SELF::FTYPE[$this->ftype]??'';
- }
- public function getHoursTextAttr(){
- $arr = explode(',', $this->hours);
- $newarr = [];
- foreach($arr as $r){
- $newarr[] = $r.":00";
- }
- return implode(",",$newarr);
- }
- // 定义主键
- protected $pk = 'id';
- //添加记录历史
- public function add($data){
- $his = [
- "create_time"=>time(),
- "update_time"=>time()
- ];
- $his = array_merge($his,$data);
- SmsRemind::create($his);
- return true;
- }
- public function getList(array $param = []){
- // 查询列表数据
- return $this->with([])->paginate(15);
- }
-
- /**
- * 更新记录
- * @param array $data
- * @return bool
- */
- public function edit(array $data)
- {
- $this->transaction(function () use ($data) {
-
- // 更新记录
- $this->save($data);
- });
- return true;
- }
- /**
- * 获取记录
- * @param int $id
- * @param array $with
- * @return static
- */
- public static function detail(int $id, array $with = [])
- {
- return static::get($id, $with);
- }
- }
|