AisStoreWorker.php 929 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 商家管理
  7. */
  8. namespace app\ais\model;
  9. use think\Model;
  10. use app\common\facade\Inform;
  11. use app\ais\model\AisStore;
  12. class AisStoreWorker extends Model{
  13. //好店工作ID和用户表绑定关系
  14. public function user(){
  15. return $this->hasOne('app\common\model\SystemUser','id','uid');
  16. }
  17. //所属好店信息
  18. public function store(){
  19. return $this->hasOne('AisStore','id','store_id');
  20. }
  21. /**
  22. * 设置好店收银员
  23. * @param integer $id
  24. */
  25. public static function setWorker(int $id){
  26. $result = self::where(['id' => $id])->field('is_cashier,uid')->find();
  27. $result->is_cashier = $result->is_cashier ? 0 : 1;
  28. return $result->save();
  29. }
  30. }