Ucenter.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\api\controller;
  10. use app\common\exception\BaseException;
  11. use think\facade\Request;
  12. use app\api\service\Ucenter as UcenterService;
  13. use app\api\service\Address as AddressService;
  14. use app\api\service\PaymentOrder as PaymentOrderService;
  15. class Ucenter extends Base {
  16. /**
  17. * 收藏列表
  18. * @return \think\response\Json
  19. */
  20. public function favorite(){
  21. try{
  22. return $this->returnAjax("ok",1,UcenterService::getFavoriteList(Request::param()));
  23. }catch (BaseException $ex){
  24. return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());
  25. }
  26. }
  27. /**
  28. * 删除收藏
  29. * @return \think\response\Json
  30. */
  31. public function favorite_delete(){
  32. try{
  33. UcenterService::favoriteDelete(Request::param("id",""));
  34. return $this->returnAjax("ok",1);
  35. }catch (\Exception $ex){
  36. return $this->returnAjax($ex->getMessage(),0);
  37. }
  38. }
  39. /**
  40. * 优惠劵
  41. * @return \think\response\Json
  42. */
  43. public function coupon(){
  44. try{
  45. return $this->returnAjax("ok",1,UcenterService::getCouponList(Request::param()));
  46. }catch (BaseException $ex){
  47. return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());
  48. }
  49. }
  50. /**
  51. * 积分列表
  52. * @return \think\response\Json
  53. */
  54. public function point(){
  55. try{
  56. return $this->returnAjax("ok",1,UcenterService::getPointList(Request::param()));
  57. }catch (BaseException $ex){
  58. return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());
  59. }
  60. }
  61. /**
  62. * 获取会员信息
  63. * @return \think\response\Json
  64. * @throws \Exception
  65. */
  66. public function info(){
  67. return $this->returnAjax("ok",1,UcenterService::getUsersInfo());
  68. }
  69. /**
  70. * 我的钱包
  71. * @return \think\response\Json
  72. */
  73. public function wallet(){
  74. return $this->returnAjax("ok",1,UcenterService::wallet());
  75. }
  76. /**
  77. * 获取会员资料
  78. * @return \think\response\Json
  79. */
  80. public function get_setting(){
  81. return $this->returnAjax("ok",1,UcenterService::getSetting());
  82. }
  83. /**
  84. * 保存会员设置
  85. * @return \think\response\Json
  86. */
  87. public function setting(){
  88. try{
  89. UcenterService::settingSave(Request::param());
  90. return $this->returnAjax("会员资料更新成功");
  91. }catch (\Exception $ex){
  92. return $this->returnAjax($ex->getMessage(),0);
  93. }
  94. }
  95. /**
  96. * 地址详细信息
  97. * @return \think\response\Json
  98. */
  99. public function address(){
  100. try{
  101. return $this->returnAjax("ok",1,AddressService::detail(Request::param("id","","intval")));
  102. }catch (\Exception $ex){
  103. return $this->returnAjax($ex->getMessage(),$ex->getCode());
  104. }
  105. }
  106. /**
  107. * 获取地址列表
  108. * @return \think\response\Json
  109. */
  110. public function address_list(){
  111. return $this->returnAjax("ok",1,AddressService::getList());
  112. }
  113. /**
  114. * 删除地址
  115. * @return \think\response\Json
  116. */
  117. public function address_delete(){
  118. AddressService::delete(Request::param("id","","intval"));
  119. return $this->returnAjax("ok");
  120. }
  121. /**
  122. * 编辑地址
  123. * @return \think\response\Json
  124. */
  125. public function address_editor(){
  126. try{
  127. return $this->returnAjax("操作成功",1,AddressService::editor(Request::param()));
  128. }catch (\Exception $ex){
  129. return $this->returnAjax($ex->getMessage(),$ex->getCode());
  130. }
  131. }
  132. /**
  133. * 设置默认地址
  134. * @return \think\response\Json
  135. */
  136. public function set_default_address(){
  137. AddressService::setDefaultAddress(Request::param("id","0","intval"));
  138. return $this->returnAjax("ok",1);
  139. }
  140. /**
  141. * 获取帮助内容
  142. * @return \think\response\Json
  143. * @throws \think\db\exception\DataNotFoundException
  144. * @throws \think\db\exception\DbException
  145. * @throws \think\db\exception\ModelNotFoundException
  146. */
  147. public function help(){
  148. return $this->returnAjax("ok",1, UcenterService::getHelpList());
  149. }
  150. /**
  151. * 资金明细
  152. * @return \think\response\Json
  153. * @throws \think\db\exception\DataNotFoundException
  154. * @throws \think\db\exception\DbException
  155. * @throws \think\db\exception\ModelNotFoundException
  156. */
  157. public function fund(){
  158. try{
  159. return $this->returnAjax("ok",1,UcenterService::getFundList(Request::param()));
  160. }catch (BaseException $ex){
  161. return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());
  162. }
  163. }
  164. /**
  165. * 提现记录
  166. * @return \think\response\Json
  167. * @throws \think\db\exception\DataNotFoundException
  168. * @throws \think\db\exception\DbException
  169. * @throws \think\db\exception\ModelNotFoundException
  170. */
  171. public function cashlist(){
  172. try{
  173. return $this->returnAjax("ok",1,UcenterService::getCashList(Request::param()));
  174. }catch (BaseException $ex){
  175. return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());
  176. }
  177. }
  178. /**
  179. * 充值
  180. * @return \think\response\Json
  181. */
  182. public function rechange(){
  183. try{
  184. return $this->returnAjax("ok",1,PaymentOrderService::recharge(Request::param()));
  185. }catch (\Exception $ex){
  186. return $this->returnAjax($ex->getMessage(),$ex->getCode());
  187. }
  188. }
  189. /**
  190. * 获取充值金额
  191. * @return \think\response\Json
  192. */
  193. public function rechange_price(){
  194. return $this->returnAjax('ok',1,UcenterService::rechangePrice());
  195. }
  196. /**
  197. * 申请提现
  198. * @return \think\response\Json
  199. */
  200. public function settlement(){
  201. return $this->returnAjax("ok",1,UcenterService::settlement());
  202. }
  203. /**
  204. * 提交提现申请
  205. * @return \think\response\Json
  206. */
  207. public function settlement_save(){
  208. try{
  209. UcenterService::settlementSave(Request::post());
  210. return $this->returnAjax("申请提现成功,请等待管理员审核");
  211. }catch (\Exception $ex){
  212. return $this->returnAjax($ex->getMessage(),0);
  213. }
  214. }
  215. /**
  216. * 上传头像
  217. * @return \think\response\Json
  218. */
  219. public function avatar() {
  220. try{
  221. return $this->returnAjax("ok",1,UcenterService::upload());
  222. }catch (\Exception $ex){
  223. return $this->returnAjax($ex->getMessage(),$ex->getCode());
  224. }
  225. }
  226. }