MemberMiniAppModel.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Author: 芸众商城 www.yunzshop.com
  5. * Date: 17/2/23
  6. * Time: 上午10:44
  7. */
  8. /**
  9. * 小程序登录表
  10. */
  11. namespace app\frontend\modules\member\models;
  12. use app\common\traits\ReplaceableModelTrait;
  13. class MemberMiniAppModel extends \app\common\models\MemberMiniAppModel
  14. {
  15. use ReplaceableModelTrait;
  16. public static function insertData($data)
  17. {
  18. self::insert($data);
  19. }
  20. public static function getUserInfo($openid)
  21. {
  22. return self::uniacid()
  23. ->where('openid', $openid)
  24. ->first();
  25. }
  26. public static function updateUserInfo($openid, $data)
  27. {
  28. return self::uniacid()
  29. ->where('openid', $openid)
  30. ->update($data);
  31. }
  32. public static function updateData($uid, $data)
  33. {
  34. self::uniacid()
  35. ->where('member_id', $uid)
  36. ->update($data);
  37. }
  38. public static function getMemberByToken($token)
  39. {
  40. return self::uniacid()
  41. ->where('access_token', $token)
  42. ->first();
  43. }
  44. }