yii_yun 2018-05-15 18:20:23 2758次浏览 1条回复 0 0 0

`<?php

namespace app\models;

use Yii;

/**

  • This is the model class for table "cz_order". *
  • @property int $id
  • @property string $sn 订单号
  • @property int $status 1新建订单,2订单确认,3申请退款,4退款完成,5订单交易成功,6订单取消,7订单过期
  • @property int $pay_status 0为未支付,1为已支付
  • @property int $add_time 订单创建时间
  • @property int $success_time 交易成功时间
  • @property int $refund_time 申请退款时间
  • @property int $table_id 桌台ID
  • @property int $num 菜品总数量
  • @property string $amount 订单总价格
  • @property int $store_id 店铺ID
  • @property int $waiter_id 服务员ID
  • @property int $u_id 用户id
  • @property int $pay_type 支付方式 0微信,1支付宝,2会员卡,3现金,4刷卡
  • @property int $is_yh 是否参与优惠,如果有优惠填入优惠ID
  • @property int $type 1到店单,2外卖单,3预定
  • @property int $wm 0,1外卖确认
  • @property int $cash_id 收银id
  • @property string $cash_price 收银实收的钱
  • @property string $p_num 订单人数 / class CzOrder extends \yii\db\ActiveRecord { /*

    • @inheritdoc */ public static function tableName() { return 'cz_order'; }

    /**

    • @inheritdoc */ public function rules() { return [
       [['add_time', 'success_time', 'refund_time', 'table_id', 'num', 'store_id', 'waiter_id', 'u_id', 'is_yh', 'cash_id'], 'integer'],
       [['amount', 'cash_price'], 'number'],
       [['sn', 'p_num'], 'string', 'max' => 255],
       [['status', 'pay_status', 'wm'], 'string', 'max' => 4],//这几个字段在数据库的类型都是tinyint,不是string
       [['pay_type', 'type'], 'string', 'max' => 3],
      

      ]; }

    /**

    • @inheritdoc */ public function attributeLabels() { return [
       'id' => 'ID',
       'sn' => 'Sn',
       'status' => 'Status',
       'pay_status' => 'Pay Status',
       'add_time' => 'Add Time',
       'success_time' => 'Success Time',
       'refund_time' => 'Refund Time',
       'table_id' => 'Table ID',
       'num' => 'Num',
       'amount' => 'Amount',
       'store_id' => 'Store ID',
       'waiter_id' => 'Waiter ID',
       'u_id' => 'U ID',
       'pay_type' => 'Pay Type',
       'is_yh' => 'Is Yh',
       'type' => 'Type',
       'wm' => 'Wm',
       'cash_id' => 'Cash ID',
       'cash_price' => 'Cash Price',
       'p_num' => 'P Num',
      

      ]; } } ` 看上面的代码 [['status', 'pay_status', 'wm'], 'string', 'max' => 4], 这几个字段在数据库的类型都是tinyint,不是string,gii把它不能识别的类型通通当成string了,直接导致我操作数据失败,有没有哪位大哥能把这个BUG提交给yii的开发者们,希望下一个版本能被修复

您需要登录后才可以回复。登录 | 立即注册