5 changed files with 118 additions and 0 deletions
-
26app/Controller/v3/MiniSubscribeMsgController.php
-
22app/Model/v3/SubscribeMessageTemplate.php
-
51app/Service/v3/Implementations/MiniprogramService.php
-
18app/Service/v3/Interfaces/MiniprogramServiceInterface.php
-
1config/routes.php
@ -0,0 +1,26 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Controller\v3; |
||||
|
|
||||
|
use App\Service\v3\Interfaces\MiniprogramServiceInterface; |
||||
|
use Hyperf\Di\Annotation\Inject; |
||||
|
use Hyperf\Validation\ValidationException; |
||||
|
|
||||
|
class MiniSubscribeMsgController extends \App\Controller\BaseController |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* @Inject |
||||
|
* @var MiniprogramServiceInterface |
||||
|
*/ |
||||
|
protected $miniprogramService; |
||||
|
|
||||
|
public function getTemplates() |
||||
|
{ |
||||
|
$forUserType = $this->request->input('for_user_type'); |
||||
|
|
||||
|
$templates = $this->miniprogramService->getSubscribeMessageTempList($forUserType); |
||||
|
return $this->success(['templates' => $templates]); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Model\v3; |
||||
|
|
||||
|
use App\Model\Model; |
||||
|
use Hyperf\Database\Model\Builder; |
||||
|
use Hyperf\Database\Model\SoftDeletes; |
||||
|
|
||||
|
class SubscribeMessageTemplate extends Model |
||||
|
{ |
||||
|
use SoftDeletes; |
||||
|
protected $table = 'lanzu_subscribe_message_template'; |
||||
|
|
||||
|
protected function boot(): void |
||||
|
{ |
||||
|
parent::boot(); |
||||
|
self::addGlobalScope('normal', function (Builder $builder) { |
||||
|
$builder->where([$this->getTable().'.is_active' => 1]); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue