[关闭]
@fuyb1986 2017-01-18T08:21:40.000000Z 字数 3108 阅读 706

店铺用户登录和CRM

金色童年


店铺用户登录后获取个人用户信息,用 is_shop 字段判断是否店铺用户

获取店铺信息

Method and URL Structure

Method Resource URL
GET /shop/whoami/

Request Paramaters

No Applicatated

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/shop/whoami/

Response

  1. {
  2. "pk":18,
  3. "owner":39,
  4. "name":"店三",
  5. "avatar_url":"http://pic.example.com/0.jpg",
  6. "region":"华东地区",
  7. "province":"上海",
  8. "city":"上海市",
  9. "district":"浦东新区",
  10. "address":"云里路",
  11. "linkman":"13212345671",
  12. "desc":"店铺介绍",
  13. "position":"31.21843415810747,121.55334830694574",
  14. "completed":false
  15. }

获取客户列表

Method and URL Structure

Method Resource URL
GET /shop/clients/

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. http://localhost/shop/clients/

Response

  1. {
  2. "count":4,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "username":"test_004",
  7. "nickname": "昵称",
  8. "owner": 123,
  9. "is_star":false,
  10. "interview":{
  11. "pk":8,
  12. "created":"2016-11-22T18:31:30.779426"
  13. "text": "测试访问第一",
  14. }
  15. },...]
  16. }

获取星标客户 id 列表, 添加、删除星标用户

Method and URL Structure

Method Resource URL
GET /shop/star_clients/
POST /shop/star_client/add/
DELETE /shop/star_client/delete/

Request Data

  1. {
  2. 'user_id': 99
  3. }

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. http://localhost/shop/start_clients/

Reponse

  1. {
  2. "status":0,
  3. "star_client_list":["60","59","58"],
  4. "message":""
  5. }

获取访问列表

Method and URL Structure

Method Resource URL
GET /shop/interviews/

Request Paramaters

  1. {
  2. "user_id": 33
  3. }

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. http://localhost/shop/interviews/?user=33

Reponse

  1. {
  2. "count":2,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":7,
  7. "shop":10,
  8. "user":33,
  9. "text":"测试访问第一",
  10. "created":"2016-11-21T21:36:27.844735"
  11. },...]
  12. }

获取、添加、删除用户访问

Method and URL Structure

Method Resource URL
GET /shop/interview/${pk}/
POST /shop/interview/create/
DELETE /shop/interview/delete/${pk}

Request Data

  1. {
  2. "user": 33,
  3. "text": "测试访问第一",
  4. }

cURL Example

  1. curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. --data '{...}' http://localhost/shop/interview/134/

Reponse

  1. {
  2. "pk":3,
  3. "shop":9,
  4. "user":33,
  5. "text":"测试访问第一",
  6. "created":"2016-11-21T21:36:26.769269"
  7. }

获取备注列表

Method and URL Structure

Method Resource URL
GET /shop/ramarks/

Request Paramaters

  1. {
  2. "user_id": 33
  3. }

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. http://localhost/shop/remarks/?user_id=33

Reponse

  1. {
  2. "count":2,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":7,
  7. "shop":10,
  8. "user":33,
  9. "text":"测试备注第一",
  10. "created":"2016-11-21T21:36:27.844735"
  11. },...]
  12. }

获取、添加、删除用户备注

Method and URL Structure

Method Resource URL
GET /shop/remark/${pk}/
POST /shop/remark/create/
DELETE /shop/remark/delete/${pk}

Request Data

  1. {
  2. "user": 33,
  3. "text": "测试访问第一",
  4. }

cURL Example

  1. curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. --data '{...}' http://localhost/shop/remark/134/

Reponse

  1. {
  2. "pk":3,
  3. "shop":9,
  4. "user":33,
  5. "text":"测试访问第一",
  6. "created":"2016-11-21T21:36:26.769269"
  7. }

给客户发短信

Method and URL Structure

Method Resource URL
POST /shop/client/send_message/${username}/

Request Data

  1. {
  2. "text": "Hello! Welcome!",
  3. }

cURL Example

  1. curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. --data '{...}' http://localhost/shop/client/send_message/12345678910/
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注