2017 © Pedro Peláez
 

library xxh-sdk

xinxihua.com sdk.

image

herojhc/xxh-sdk

xinxihua.com sdk.

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md


title: 信息化平台SDK使用说明 tags: 信息化、SDK, (*1)

grammar_mindmap: true

环境

laravel 5.5 或 5.6 以及他们需要的环境, (*2)

安装

``` r composer require herojhc/xxh-sdk, (*3)


# 配置 ## 发布配置 ``` php-cli php artisan vendor:publish --provider="XinXiHua\SDK\XXHServiceProvider" --tag="xxh-sdk-config"

运行迁移

``` php-cli php artisan vendor:publish --provider="XinXiHua\SDK\XXHServiceProvider" --tag="xxh-sdk-migrations", (*4)

php artisan migrate, (*5)


## 修改User模型主键 ``` php protected $primaryKey = 'user_id';

参数说明

配置环境变量, (*6)

``` makefile, (*7)

-----------

AppId,具体见应用详情

REST_CLIENT_ID=cd188ae7d6344beb8ccc660643bf886f, (*8)

AppSecret,具体见应用详情

REST_CLIENT_SECRET=138fa802f76c4f0ba472cfe9d9ebf852, (*9)

Api 地址

REST_CLIENT_API_URL=https://api.xinxihua.com, (*10)

具体API的HOST,不同的API分支对应不同的HOST,具体见信息化平台API总览

REST_CLIENT_API_HOST=api.v2.services.xinxihua.com, (*11)

-------------

应用的ID(信息化平台),具体见应用详情

AUTH_AGENT_ID=10000, (*12)

前台回调地址

AUTH_CALLBACK_HOME_URL=http://crm.xinxihua.com/callback, (*13)

登录后前台跳转页面

AUTH_REDIRECT_HOME_URL=http://crm.xinxihua.com/home, (*14)

后台回调地址

AUTH_CALLBACK_ADMIN_URL=http://crm.xinxihua.com/admin/callback, (*15)

登录后后台跳转地址

AUTH_REDIRECT_ADMIN_URL=http://crm.xinxihua.com/admin, (*16)

信息化平台地址

AUTH_PALTFORM_URL=https://oa.xinxihua.com, (*17)

信息化平台授权登陆地址

AUTH_GATEWAY_URL=https://oa.xinxihua.com/sso-login, (*18)

应用通讯的TOKEN

AUTH_TOKEN=1QchOH0JQ6PGTCcFSapG, (*19)

应用通讯的加密字符串

AUTH_ENCODING_KEY=ZOFV3OSokCBmaC34zP3FM41B88dccl7AC65RuaoyuaB, (*20)



# 使用 ## 路由配置 * 在web路由中配置 ``` php XXH::routes();

说明:XXH::routes() 包含以下路由,如果要控制权限,可以通过中间件方式, (*21)

``` php Route::get('login', '\XinXiHua\SDK\Http\Controllers\LoginController@login')->name('login'); Route::post('logout', '\XinXiHua\SDK\Http\Controllers\LoginController@logout')->name('logout'); Route::get('callback', '\XinXiHua\SDK\Http\Controllers\LoginController@callback')->name('callback'); Route::get('admin/login', '\XinXiHua\SDK\Http\Controllers\Admin\LoginController@login')->name('admin.login'); Route::post('admin/logout', '\XinXiHua\SDK\Http\Controllers\Admin\LoginController@logout')->name('admin.logout'); Route::get('admin/callback', '\XinXiHua\SDK\Http\Controllers\Admin\LoginController@callback')->name('admin.callback'); Route::any('serve', '\XinXiHua\SDK\Http\Controllers\ServeController@serve')->name('serve');, (*22)


* 将 serve 添加到 VerifyCsrfToken 中间件中 ``` php <?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; class VerifyCsrfToken extends Middleware { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ // 'serve' ]; }

用法

``` php, (*23)

<?php /** * Created by PhpStorm. * User: JHC * Date: 2018-07-24 * Time: 11:51 */, (*24)

namespace XinXiHua\SDK\Services;, (*25)

use Illuminate\Support\Facades\Log; use XinXiHua\SDK\Exceptions\ApiException;, (*26)

class ContactService extends BaseService {, (*27)

public function all()
{
    $response = $this->client->get('/contacts');

    Log::info($response->getResponse());
    if ($response->isResponseSuccess()) {
        return $response->getResponseData()['data'];
    }
    throw new ApiException($response->getResponseData()['message']);

}

}, (*28)

```, (*29)

The Versions

25/07 2018

dev-master

9999999-dev https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

25/07 2018

0.1.6

0.1.6.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

25/07 2018

0.1.5

0.1.5.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

25/07 2018

0.1.4

0.1.4.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

25/07 2018

0.1.3

0.1.3.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.1.2

0.1.2.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.1.1

0.1.1.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.1.0

0.1.0.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.9

0.0.9.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.8

0.0.8.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.7

0.0.7.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.6

0.0.6.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.5

0.0.5.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.4

0.0.4.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.3

0.0.3.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.2

0.0.2.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua

24/07 2018

0.0.1

0.0.1.0 https://www.xinxihua.com

xinxihua.com sdk.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api client oauth2 xinxihua