12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace app\admin\model;
- use think\Model;
- use think\model\concern\SoftDelete;
- class OrderCategory extends Model{
- use SoftDelete;
- protected $createTime = 'createTime';
- protected $deleteTime='delete_time';
- public static function checkInfo($code,$orderType,$info){
- if(!empty($info)){
- $save=[];
- foreach ($info as $key=>$value){
- $ist = self::where(["code"=>$code,"order_type"=>$orderType,"spuCode"=>$value['spuCode']])->findOrEmpty();
- if($ist->isEmpty()){
- $Temp=[
- "code"=>$code,
- "order_type"=>$orderType,
- "spuCode"=>$value['spuCode'],
- "cat_code"=>$value['cat_code'],
- "cat_name"=>$value['cat_name'],
- "tax"=>$value['tax'],
- "inv_good_name"=>$value['inv_good_name']
- ];
- $save[]=$Temp;
- }
- }
- if(!empty($save)){
- self::insertAll($save);
- }
- }
- }
- }
|