user_id = $user_id; $records->zone_goods_id = $z_g_id; $records->price = $price; $records->text_data = serialize($data); $records->actual_price = $actual_price; $records->residue_amount = $residue_amount; $records->create_time = date("Y-m-d H:i:s",time()); $records->save(); return $records->id; } /** * 完成订单 * @param $c_r_id * @param $awards_amount // 中奖金额 * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function endOrder($c_r_id,$awards_amount) { $zoneOrder = ConsumptionRecords::find($c_r_id); $zoneOrder->status = 1; $zoneOrder->complete_time = date("Y-m-d H:i:s",time()); if ($awards_amount > 0) { $zoneOrder->awards_status = 1; } $zoneOrder->save(); } /** * 保存是否中奖字段 * @param $data * @param $id * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function awardsData($data,$id) { $ConsumptionRecords = ConsumptionRecords::find($id); $ConsumptionRecords->text_data = serialize($data); $ConsumptionRecords->save(); } }