Mbusertoken.php 1.8 KB

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