1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\allwin\model;
- use think\Model;
- class AllwinInfoReply extends Model{
- protected $pk = 'id';
- protected $autoWriteTimestamp = true;
- protected $datetime_format = 'Y-m-d H:i:s.u';
-
- public function user(){
- return $this->hasOne('app\common\model\SystemUser','id','user_id');
- }
-
- public function info(){
- return $this->hasOne('AllwinInfo','id','info_id');
- }
-
- public static function postReply($param){
- $data['reply'] = trim($param['content']);
- $data['member_miniapp_id'] = (int)$param['member_miniapp_id'];
- $data['user_id'] = (int)$param['user_id'];
- $data['info_id'] = (int)$param['info_id'];
- $data['create_time'] = time();
- $data['state'] = 1;
- return self::insert($data);
- }
-
- public static function lock(int $id){
- $result = self::get($id);
- $result->state = $result->state ? 0 : 1;
- return $result->save();;
- }
- }
|