12345678910111213141516171819202122232425 |
- <?php
- namespace app\common\model;
- use think\Model;
- class UserTax extends Model
- {
- protected $type=[
- 'tax'=>'json',
- ];
- public static function fromOrder(Orders $orders){
- if($orders['tax']){
- $has=self::where('user_id',$orders['user_id'])->where('tax',json_encode($orders['tax'],JSON_UNESCAPED_UNICODE))->find();
- if(!$has) {
- self::create([
- 'user_id' => $orders['user_id'],
- 'tax' => $orders['tax'],
- ]);
- }
- }
- }
- }
|