Orderreturn.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "order_return".
  6. *
  7. * @property int $id
  8. * @property string|null $deliveryid
  9. * @property string|null $website
  10. * @property string|null $customer
  11. * @property string|null $delivery
  12. * @property string|null $origin_goodsinfo
  13. * @property string|null $goodsinfo
  14. * @property string|null $usage
  15. * @property string|null $receiptdate
  16. * @property int|null $num
  17. * @property string|null $mark
  18. */
  19. class Orderreturn extends \yii\db\ActiveRecord
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public static function tableName()
  25. {
  26. return 'order_return';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function rules()
  32. {
  33. return [
  34. [[ 'num','shop'], 'integer'],
  35. [['deliveryid', 'website', 'customer', 'receiptdate','delivery', 'origin_goodsinfo', 'goodsinfo', 'usage', 'mark'], 'string', 'max' => 255],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'deliveryid' => '收到单号',
  46. 'website' => '网站',
  47. 'customer' => '客户',
  48. 'delivery' => '货运',
  49. 'origin_goodsinfo' => '原订单货物详情',
  50. 'goodsinfo' => '货物详情',
  51. 'usage' => '完好程度',
  52. 'receiptdate' => '收货日期',
  53. 'num' => '当天序号',
  54. 'mark' => '备注',
  55. 'shop'=>'店铺'
  56. ];
  57. }
  58. public function afterFind(){
  59. parent::afterFind();
  60. $this->receiptdate=date('Y-m-d',$this->receiptdate);
  61. }
  62. public function beforeSave($options = array()){
  63. parent::beforeSave($options);
  64. $this->receiptdate=strtotime(trim($this->receiptdate));
  65. if(empty($this->created_at)){
  66. $this->created_at=time();
  67. }
  68. return $this;
  69. // dd($this);
  70. }
  71. }