* 门店管理 */ namespace app\allwin\model; use think\Model; class AllwinStoreChain extends Model{ //主店铺 public function store(){ return $this->hasOne('AllwinStore','id','store_id'); } /** * 置顶或取消 * @param integer $id */ public static function isType(int $id){ $result = self::where(['id' => $id])->field('types')->find(); $result->types = $result->types ? 0 : 1; return $result->save(); } }