| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace app\model\saas;
- use app\extra\basic\Model;
- use think\model\relation\HasOne;
- /**
- * @property integer $id (主键)
- * @property integer $store_id 来客账户id
- * @property integer $agent_id 代理id
- * @property integer $product_id
- * @property string $product_name
- * @property string $express_name 面单打印名称
- * @property string $product_img
- * @property integer $product_price
- * @property integer $product_orgin 划线价
- * @property integer $out_id 来客商品ID
- * @property integer $status
- * @property mixed $create_at
- */
- class SaasGoods extends Model
- {
- /**
- * The connection name for the model.
- *
- * @var string|null
- */
- protected $connection = 'mysql';
-
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected string $table = "saas_goods";
-
- /**
- * The primary key associated with the table.
- *
- * @var string
- */
- protected string $primaryKey = "id";
-
- /**
- * Indicates if the model should be timestamped.
- *
- * @var bool
- */
- public bool $timestamps = false;
- public function getProductPriceAttr($data): string
- {
- if ($data == 0) return 0;
- return format_money($data/100);
- }
- public function getProductOriginAttr($data): string
- {
- if ($data == 0) return 0;
- return format_money($data/100);
- }
- public function agent(): HasOne
- {
- return $this->hasOne("app\model\saas\SaasAgent","agent_id","agent_id");
- }
- public function store(): HasOne
- {
- return $this->hasOne("app\model\saas\SaasStore","store_id","store_id");
- }
- public function print(): HasOne
- {
- return $this->hasOne("app\model\saas\SaasPrint","sn","print_id");
- }
- }
|