1, "pay_way"=>0 ); $GameSupersign = M("GameSupersign","tab_"); $dbres = $GameSupersign->field("id,trade_id")->where($map)->select(); $countdb = count($dbres); if($countdb < 1){ die("No initialization required"); } foreach ($dbres as $key => $value) { $savedata = array( "id"=>$value['id'] ); $tmp = (int)substr($value['trade_id'],0,4); if($tmp > 3000){ $savedata['pay_way'] = 2; //微信 }else{ $savedata['pay_way'] = 1;//支付宝 } $tres = $GameSupersign->save($savedata); if($tres === false){ die("DB ERROR"); } } die("init ok"); } }