OrderBatchDelivery.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace common\models\order;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%order_batch_delivery}}".
  6. *
  7. *
  8. * @property int $id ID
  9. * @property int $mall_id 商城ID
  10. * @property int $operator_id 操作人ID
  11. * @property string $operator_name 操作人昵称
  12. * @property string $delivery_file 批量发货文件地址
  13. * @property int $express_id 快递公司id
  14. * @property string $express_name 物流公司名称
  15. * @property int $delivery_num 发货单数
  16. * @property int $success_delivery_num 成功发货单数
  17. * @property int $delivery_status 批量发货状态【0:处理中,1:已完成】
  18. * @property int $status 状态【1启用 0禁用 -1删除】
  19. * @property int $created_at 创建时间
  20. * @property int $updated_at 更新时间
  21. */
  22. class OrderBatchDelivery extends \common\models\base\BaseActiveRecord
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName()
  28. {
  29. return '{{%order_batch_delivery}}';
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['mall_id', 'operator_id', 'express_id', 'delivery_num', 'success_delivery_num', 'delivery_status', 'status', 'created_at', 'updated_at'], 'integer'],
  38. [['operator_name', 'express_name'], 'string', 'max' => 100],
  39. [['delivery_file'], 'string', 'max' => 500],
  40. ];
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function attributeLabels()
  46. {
  47. return [
  48. 'id' => 'ID',
  49. 'mall_id' => '商城ID',
  50. 'operator_id' => '操作人ID',
  51. 'operator_name' => '操作人昵称',
  52. 'delivery_file' => '批量发货文件地址',
  53. 'express_id' => '快递公司id',
  54. 'express_name' => '物流公司名称',
  55. 'delivery_num' => '发货单数',
  56. 'success_delivery_num' => '成功发货单数',
  57. 'delivery_status' => '批量发货状态【0:处理中,1:已完成】',
  58. 'status' => '状态【1启用 0禁用 -1删除】',
  59. 'created_at' => '创建时间',
  60. 'updated_at' => '更新时间',
  61. ];
  62. }
  63. /**
  64. * 保存数据
  65. * @Author: lun
  66. * @DateTime: 2021/12/1 0001 18:47
  67. * @Copyright: copyright (c) 2021 广东七件事集团
  68. * @param $mall_id
  69. * @param $params
  70. * @return bool
  71. */
  72. public static function setData($mall_id, $params)
  73. {
  74. try {
  75. $mobel = new self();
  76. $mobel->mall_id = $mall_id;
  77. if (!$mobel->load($params, '') || !$mobel->save()) throw new \Exception($mobel->getErrorMessage());
  78. return $mobel;
  79. } catch (\Exception $e) {
  80. self::setStaticError($e->getMessage());
  81. return false;
  82. }
  83. }
  84. }