ShippingTemplateUndelivery.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * @package merchant
  4. * Author: Qinii
  5. * Date: 2020/5/6
  6. * Time: 14:19
  7. */
  8. namespace app\common\model\store\shipping;
  9. use app\common\model\BaseModel;
  10. class ShippingTemplateUndelivery extends BaseModel
  11. {
  12. /**
  13. * Author:Qinii
  14. * Date: 2020/5/6
  15. * Time: 14:20
  16. * @return string
  17. */
  18. public static function tablePk(): string
  19. {
  20. return 'shipping_template_undelivery_id';
  21. }
  22. /**
  23. * Author:Qinii
  24. * Date: 2020/5/6
  25. * Time: 14:20
  26. * @return string
  27. */
  28. public static function tableName(): string
  29. {
  30. return 'shipping_template_undelivery';
  31. }
  32. public function getCityIDsAttr($value,$data)
  33. {
  34. $city_id = explode('/',$data['city_id']);
  35. $result = [];
  36. if(is_array($city_id)){
  37. foreach ($city_id as $v){
  38. $result[] = [City::where('city_id',$v)->value('parent_id') ?? 0,intval($v) ];
  39. }
  40. }else{
  41. $result['city_id'] = [];
  42. }
  43. return $result;
  44. }
  45. public function setCityIdAttr($value)
  46. {
  47. return '/'.implode('/',$value).'/';
  48. }
  49. }