xhShop.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace common\models;
  3. /**
  4. * This is the model class for table "xhShop".
  5. *
  6. * @property int $id
  7. * @property string $businessName 门店名称,商户名称
  8. * @property string $branchName 分店名称
  9. * @property int $merchantId 商户id
  10. * @property string $poiId 微信门店 wifi等通用的唯一id
  11. * @property string $shopId shopId 适用于wifi
  12. * @property string $shopLat 商店的纬度
  13. * @property string $shopLong 商店的经度
  14. * @property string $shopProvince 省
  15. * @property string $shopCity 市
  16. * @property string $shopDist 区县
  17. * @property string $shopAddress 详细街道地址
  18. * @property string $telephone 电话
  19. * @property string $introduction 简介
  20. * @property int $addTime 添加时间,时间戳格式
  21. * @property string $createTime 创建时间
  22. * @property string $updateTime
  23. */
  24. class xhShop extends xhBaseModel
  25. {
  26. /**
  27. * @inheritdoc
  28. */
  29. public static function tableName()
  30. {
  31. return 'xhShop';
  32. }
  33. /**
  34. * @inheritdoc
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['merchantId', 'addTime', 'status'], 'integer'],
  40. [['createTime'], 'required'],
  41. [['createTime', 'updateTime'], 'safe'],
  42. [['businessName', 'branchName'], 'string', 'max' => 100],
  43. [['poiId', 'shopId', 'shopLat', 'shopLong', 'shopProvince', 'shopCity', 'shopDist', 'shopAddress', 'telephone'], 'string', 'max' => 20],
  44. [['introduction'], 'string', 'max' => 800],
  45. ];
  46. }
  47. /**
  48. * @inheritdoc
  49. */
  50. public function attributeLabels()
  51. {
  52. return [
  53. 'id' => 'ID',
  54. 'businessName' => 'Business Name',
  55. 'branchName' => 'Branch Name',
  56. 'merchantId' => 'Merchant ID',
  57. 'poiId' => 'Poi ID',
  58. 'shopId' => 'Shop ID',
  59. 'shopLat' => 'Shop Lat',
  60. 'shopLong' => 'Shop Long',
  61. 'shopProvince' => 'Shop Province',
  62. 'shopCity' => 'Shop City',
  63. 'shopDist' => 'Shop Dist',
  64. 'shopAddress' => 'Shop Address',
  65. 'telephone' => 'Telephone',
  66. 'introduction' => 'Introduction',
  67. 'status' => 'Shop Status',
  68. 'addTime' => 'Add Time',
  69. 'createTime' => 'Create Time',
  70. 'updateTime' => 'Update Time',
  71. ];
  72. }
  73. public static function updateByPoiId($poiId, $data){
  74. $cond = ['poiId' => $poiId];
  75. return self::updateByCondition($cond, $data);
  76. }
  77. public static function getByPoiId($poiId)
  78. {
  79. $condition = ['poiId' => $poiId];
  80. return self::find()->where($condition)->asArray()->one();
  81. }
  82. }