memodel.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: sicilon_IT
  5. * Date: 2019/12/7
  6. * Time: 11:11
  7. */
  8. namespace app\index\model;
  9. use think\Model;
  10. class memodel extends Model{
  11. // private $me_tabel;
  12. protected $table = 't_wxuser';
  13. // public function initialize(){
  14. // //echo "in";
  15. // $this->me_tabel=model("tEquipmentMe");
  16. // echo 'init';
  17. // }
  18. public function saveme($userinfo){
  19. $r_id=$this->allowField(true)->save($userinfo);
  20. return $r_id;
  21. }
  22. public function getinfobyopenid($openid){
  23. $record=$this->where("open_id",$openid)->find();
  24. return $record;
  25. }
  26. public function updatetelbyoopenid($openid,$tel){
  27. $r_id=$this->where("open_id",$openid)->update(['tel'=>$tel]);
  28. return $r_id;
  29. }
  30. public function insopenid($insinfo){
  31. $r_id=$this->isUpdate(false)->save($insinfo);
  32. return $this->id;
  33. }
  34. /*
  35. * 20200226
  36. * steelxu5
  37. * 增加了根据openid更新信息的
  38. */
  39. public function updateinfobyopenid($openid,$arr){
  40. $r_id=$this->where("open_id",$openid)->update($arr);
  41. return $r_id;
  42. }
  43. /*
  44. * 20200401
  45. * 根据ID获取呢称
  46. */
  47. public function selnamebyid($id){
  48. $where_arr['id']=$id;
  49. $cinfo=$this->where($where_arr)->find();
  50. return $cinfo;
  51. }
  52. /*
  53. * 20200927
  54. * 根据UNIONID获取信息,openid,uid
  55. */
  56. public function selinfobyunionid($unionid){
  57. $where_arr['union_id']=$unionid;
  58. $cinfo=$this->where($where_arr)->field('id,open_id')->find();
  59. return $cinfo;
  60. }
  61. /*
  62. * 20200927
  63. * 根据openid 更新unionid
  64. */
  65. public function updunionidbyopenid($openid,$unionid){
  66. $this->where("open_id",$openid)->update(['union_id'=>$unionid]);
  67. }
  68. /*
  69. * 20200928
  70. * 根据unionid 获取openid
  71. */
  72. public function selopenidbyunionid($unionid){
  73. $rec=$this->where("union_id",$unionid)->field('id,open_id')->find();
  74. return $rec['open_id'];
  75. }
  76. }