CloudStockOrderBatchDelivery.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace addons\CloudStock\common\models;
  3. use common\models\base\BaseActiveRecord;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_cloud_stock_order_batch_delivery".
  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 CloudStockOrderBatchDelivery extends BaseActiveRecord
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName()
  28. {
  29. return 'qimall_addons_cloud_stock_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' => 'Mall ID',
  50. 'operator_id' => 'Operator ID',
  51. 'operator_name' => 'Operator Name',
  52. 'delivery_file' => 'Delivery File',
  53. 'express_id' => 'Express ID',
  54. 'express_name' => 'Express Name',
  55. 'delivery_num' => 'Delivery Num',
  56. 'success_delivery_num' => 'Success Delivery Num',
  57. 'delivery_status' => 'Delivery Status',
  58. 'status' => 'Status',
  59. 'created_at' => 'Created At',
  60. 'updated_at' => 'Updated At',
  61. ];
  62. }
  63. public static function setData($mall_id, $params)
  64. {
  65. try {
  66. $mobel = new self();
  67. $mobel->mall_id = $mall_id;
  68. if (!$mobel->load($params, '') || !$mobel->save()) throw new \Exception($mobel->getErrorMessage());
  69. return $mobel;
  70. } catch (\Exception $e) {
  71. self::setStaticError($e->getMessage());
  72. return false;
  73. }
  74. }
  75. }