123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class ActivityWorkStation extends Model
- {
- // 获取站点token
- public static function getToekn($wsId, $wsType, $wsName ='')
- {
- $res = self::where('work_station_id', $wsId)
- ->where('work_station_type', $wsType)
- ->first();
- if($res) {
- if($wsName){
- $res->name = $wsName;
- $res->token = md5($wsId.'.'.$wsType.'.'.$wsName);
- $res->save();
- }
- }else {
- $model = new self();
- $model->name = $wsName;
- $model->work_station_type = $wsType;
- $model->work_station_id = $wsId;
- $model->token = md5($wsId.'.'.$wsType.'.'.$wsName);
- if($model->save()){
- $res= $model;
- }
- }
- return $res;
- }
- }
|