UserPermission.php 768 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Author: 芸众商城 www.yunzshop.com
  5. * Date: 02/03/2017
  6. * Time: 18:27
  7. */
  8. namespace app\common\models\user;
  9. use app\common\models\BaseModel;
  10. class UserPermission extends BaseModel
  11. {
  12. public $table = 'users_permission';
  13. protected $guarded = [''];
  14. public $timestamps = false;
  15. public function __construct()
  16. {
  17. if (config('app.framework') == 'platform') {
  18. $this->table = 'yz_users_permission';
  19. }
  20. }
  21. final function addUserPermission($userId)
  22. {
  23. return $this->insert([
  24. 'uniacid' => \YunShop::app()->uniacid,
  25. 'uid' => $userId,
  26. 'type' => 'yun_shop',
  27. 'permission' => 'all',
  28. 'url' => ''
  29. ]);
  30. }
  31. }