1、高访问防止并行覆盖
$member_data = Member::find()->select($select)->where(['id'=>$member_id])->one();$model->money_A = $member_data->user_money;$update = Yii::$app->db->createCommand()->update('user',array( 'user_money' =>new \yii\db\Expression('user_money+'.$num), 'last_get_money_time'=>time(), 'user_money_status'=>1, 'user_skill_status'=>1 ),"id=".$member_id)->execute();//返回条数if($update){ $member_data = Member::find()->select($select)->where(['id'=>$member_id])->one(); $model->money_B = $member_data->user_money; /* ... */}