Mbusertoken.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * 手机端买家令牌模型
  4. */
  5. namespace app\common\model;
  6. use think\facade\Db;
  7. /**
  8. * ============================================================================
  9. *
  10. * ============================================================================
  11. *
  12. * ----------------------------------------------------------------------------
  13. *
  14. * ============================================================================
  15. * 数据层模型
  16. */
  17. class Mbusertoken extends BaseModel {
  18. /**
  19. * 查询
  20. * @access public
  21. * @author csdeshang
  22. * @param array $condition 查询条件
  23. * @return array
  24. */
  25. public function getMbusertokenInfo($condition) {
  26. return Db::name('mbusertoken')->where($condition)->find();
  27. }
  28. /**
  29. * 查询
  30. * @access public
  31. * @author csdeshang
  32. * @param type $token 令牌
  33. * @return type
  34. */
  35. public function getMbusertokenInfoByToken($token) {
  36. if (empty($token)) {
  37. return null;
  38. }
  39. return $this->getMbusertokenInfo(array('member_token' => $token));
  40. }
  41. /**
  42. * 编辑
  43. * @access public
  44. * @author csdeshang
  45. * @param type $token 令牌
  46. * @param type $openId ID
  47. * @return type
  48. */
  49. public function editMemberOpenId($token, $openId) {
  50. return Db::name('mbusertoken')->where(array('member_token' => $token,))->update(array('member_openid' => $openId,));
  51. }
  52. /**
  53. * 新增
  54. * @access public
  55. * @author csdeshang
  56. * @param array $data 参数内容
  57. * @return bool 布尔类型的返回结果
  58. */
  59. public function addMbusertoken($data) {
  60. return Db::name('mbusertoken')->insertGetId($data);
  61. }
  62. /**
  63. * 删除
  64. * @access public
  65. * @author csdeshang
  66. * @param int $condition 条件
  67. * @return bool 布尔类型的返回结果
  68. */
  69. public function delMbusertoken($condition) {
  70. return Db::name('mbusertoken')->where($condition)->delete();
  71. }
  72. }