初始化仓库
This commit is contained in:
51
member/modules/v1/controllers/TestController.php
Normal file
51
member/modules/v1/controllers/TestController.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* @author: liudiao
|
||||
* @Date: 2023-02-28 16:23:31
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
namespace member\modules\v1\controllers;
|
||||
|
||||
|
||||
use common\jobs\OrderRefundJob;
|
||||
use common\models\Disease;
|
||||
use common\models\Drug;
|
||||
use Overtrue\Pinyin\Pinyin;
|
||||
|
||||
|
||||
class TestController extends \yii\web\Controller
|
||||
{
|
||||
public $enableCsrfValidation = false;
|
||||
|
||||
public function actionTest()
|
||||
{
|
||||
\Yii::$app->queue->delay(0)->push(new OrderRefundJob([
|
||||
'orderId' => 11,
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
public function actionGetPinyin(){
|
||||
$type = \Yii::$app->request->post('type');
|
||||
$pinyin = new Pinyin();
|
||||
if($type == 'drug'){
|
||||
$drug = Drug::find()->where(['pinyin_simple' => null])->limit(2000)->asArray()->all();
|
||||
$num = 0;
|
||||
foreach($drug as $k=>$v){
|
||||
\Yii::$app->db->createCommand()->update('yii_drug', ['pinyin_simple' =>$pinyin->abbr($v['drug_name'])], ['id' => $v['id']])->execute();
|
||||
$num++;
|
||||
}
|
||||
return ['获取药品首拼完成,共'.$num.'药品'];
|
||||
} else {
|
||||
$disease = Disease::find()->where(['pinyin' => null])->limit(3000)->asArray()->all();
|
||||
$num = 0;
|
||||
foreach($disease as $k=>$v){
|
||||
\Yii::$app->db->createCommand()->update('yii_disease', ['pinyin' =>$pinyin->abbr($v['name'])], ['id' => $v['id']])->execute();
|
||||
$num++;
|
||||
}
|
||||
return ['获取诊断首拼完成,共'.$num.'诊断'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user